From owner-freebsd-pf@freebsd.org Thu Jun 14 20:03:58 2018 Return-Path: Delivered-To: freebsd-pf@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6C2561022222 for ; Thu, 14 Jun 2018 20:03:58 +0000 (UTC) (envelope-from ian.freislich@capeaugusta.com) Received: from mail-yw0-x22c.google.com (mail-yw0-x22c.google.com [IPv6:2607:f8b0:4002:c05::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 08B257E799 for ; Thu, 14 Jun 2018 20:03:57 +0000 (UTC) (envelope-from ian.freislich@capeaugusta.com) Received: by mail-yw0-x22c.google.com with SMTP id t198-v6so2582641ywc.3 for ; Thu, 14 Jun 2018 13:03:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=capeaugusta-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=9XzOgFU4/GGT0uKFQUlnE1+ofjwxRgk8xnOy3XhK2BE=; b=nwVsdXFgT+vEMlqpdd5wSXyukMF4xLgr3lu/dckSdREybg9/2e4bnB0+3Q8m4GMhzP 2IVQy6eCuTqgVMSojhWVgFhCkZtkuqh3Ybu5nz/BL6ifkb1O3V4YIbKLDPB9M+Gu9qtl 6jeFWNc3l7MOv+O1O7YSt8Dmnpkzsg+gLiAnJsm2OdDTjlHPGi8o8Bnv5DPhUxhonSVh 7JCz6Ea9XREM/o2bouKwLufOBtMf5Utz8a7bHYx5SEMG0TUYwliUiRrR/H9j7Jk1RF7n rpzpP12hMT0sPS5LBZF6iViVvYYN+xbyOeKassMPBYvoLzNpVps25SXBcT0XKiFyT44l NpnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=9XzOgFU4/GGT0uKFQUlnE1+ofjwxRgk8xnOy3XhK2BE=; b=WYh2wBQQUnaZ+7v9gt0VtwdXfv+nOxWX2GrLXviDH8PVfUYzNUVD/3qcFHVWZj6cxl cmTnPcqzDnTJuv3/qEs9dcHf/pS6wi+4fbh7uGYUYMfcxeou4wbMvSHvT6AdjsZz7mm9 bysF2Zpzlv5BmuKJS5HBSm5KfyGi9GBckgtru00Xf3JtuH2nxPOn/1nyGhGvoCuobC1t 2SynvHlown+4/ZqZvHtePuK7VnnjRr2z8TtJuqanws4fw77p5qin8iP4G/VvN2CRpXdg KEdRwaVFuvxcaa8KPFLzjO4rEvQNRr9q+cz0Aw7KoDxWesSvLiJ4E2KyFyELrXOYfKmw xFlg== X-Gm-Message-State: APt69E0UIfDWWidz4w0CUjE1VfwQf0AZ8OinP3IxLSqJ8F5ETXun9g3X atn3HknsnMA2DFl/0LeuhFGsy+EKSIMMleW1IBsYQUIGdzk9fnolRXCmiteHznHH5t091fo00LR 6WNcuGv/Ivm5Kywzfbkw2LGacZk+ej8325ULjUpfkHWk6TUFzK6PvY1sjvy/XQvU+8/nUqKXsG/ 8+4xPc X-Google-Smtp-Source: ADUXVKL4i9IO7+4N8kzdztV5Wh5YMIrvEilNeRl9ax0odaRTeLNNoZiRmG47o/UK7d+5utLeMEz9pw== X-Received: by 2002:a81:348e:: with SMTP id b136-v6mr2236327ywa.29.1529006636783; Thu, 14 Jun 2018 13:03:56 -0700 (PDT) Received: from [10.0.11.220] ([64.53.114.237]) by smtp.gmail.com with ESMTPSA id w189-v6sm2549986yww.62.2018.06.14.13.03.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Jun 2018 13:03:56 -0700 (PDT) Subject: Re: Is there an upper limit to PF's tables? To: Miroslav Lachman <000.fbsd@quip.cz>, Dave Horsfall , FreeBSD PF List References: <41eb69f5-a2ba-7546-f7c8-b97eb179d22e@quip.cz> From: Ian FREISLICH Message-ID: Date: Thu, 14 Jun 2018 16:03:50 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <41eb69f5-a2ba-7546-f7c8-b97eb179d22e@quip.cz> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: quoted-printable Content-Language: en-US X-BeenThere: freebsd-pf@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "Technical discussion and general questions about packet filter \(pf\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2018 20:03:58 -0000 On 06/14/2018 03:44 PM, Miroslav Lachman wrote: > Dave Horsfall wrote on 2018/06/14 19:40: >> I can't get access to kernel sauce right now, but I'm hitting over=20 >> 1,000 entries from woodpeckers[*] etc; is there some upper limit, or=20 >> is it just purely dynamic? >> >> =C2=A0=C2=A0 aneurin% freebsd-version >> =C2=A0=C2=A0 10.4-RELEASE-p9 > > One of our customers have machine with 10.4 too. They are blocking all=20 > Tor IP addresses. The table has 272574 entries now. > > There were/(are) some problems with reload of PF: > > > # service pf reload > Reloading pf rules. > /etc/pf.conf:37: cannot define table reserved: Cannot allocate memory > /etc/pf.conf:38: cannot define table czech_net: Cannot allocate memory > /etc/pf.conf:39: cannot define table goodguys: Cannot allocate memory > /etc/pf.conf:40: cannot define table badguys: Cannot allocate memory > /etc/pf.conf:41: cannot define table tor_net: Cannot allocate memory > pfctl: Syntax error in config file: pf rules not loaded > > Even if there is "set limit table-entries 300000" > > I do not understand PF internals but I think PF needs twice the memory=20 > for reload (if there are already a lot of entries). > Because workaround for this was simple as reload PF with empty table=20 > and then load table entries: Did you try setting the table limit to 500000?=C2=A0 I believe that PF does= a=20 copyin from pfctl essentially building the new inactive ruleset and=20 switching to it at commit.=C2=A0 This would result in the twice memory=20 requirement you're seeing.=C2=A0 It has been a long long time for me so I'v= e=20 probably not explained correctly. Ian --=20