All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Neal P. Murphy" <neal.p.murphy@alum.wpi.edu>
To: Sven-Haegar Koch <haegar@sdinet.de>
Cc: Thomas Delrue <thomas.delrue@fundamental-software.net>,
	netfilter@vger.kernel.org
Subject: Re: Creating, editing, removing rules from C(++)
Date: Tue, 21 Jul 2015 20:31:51 -0400	[thread overview]
Message-ID: <20150721203151.1013534d@playground> (raw)
In-Reply-To: <alpine.DEB.2.20.1507220202550.10016@aurora.sdinet.de>

On Wed, 22 Jul 2015 02:08:48 +0200 (CEST)
Sven-Haegar Koch <haegar@sdinet.de> wrote:

> On Tue, 21 Jul 2015, Neal P. Murphy wrote:
> 
> > On Tue, 21 Jul 2015 17:41:26 -0400
> > Thomas Delrue <thomas.delrue@fundamental-software.net> wrote:
> > 
> > > Is there a way to interact with the firewall rules from a C(++) program?
> > > What I'm really trying to do is have a program that only allows a
> > > certain set of CIDRs through the firewall through a particular port.
> > > However these CIDRs change from time to time and so my application is
> > > there to update the firewall rules to make sure that the firewall rules
> > > contain the latest and greatest information that says: "drop everything
> > > trying to connect to port P EXCEPT for stuff originating from these CIDRs".
> > 
> > It seems in your case that you don't need high performance or high 
> > efficiency, so you should be able to use system() to run 
> > iptables-restore.
> 
> And in this special case of "set of CIDRs" it even more sounds like a 
> job for ipset - setup a static iptables ruleset using iptables-restore, 
> and if you need performance modify the list of network ranges in a 
> hash-table using libipset.

Agreed, if the set of CIDRs is large enough.

  reply	other threads:[~2015-07-22  0:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-21 21:41 Creating, editing, removing rules from C(++) Thomas Delrue
2015-07-21 22:30 ` alvin
     [not found]   ` <55AECB5B.9090302@fundamental-software.net>
2015-07-22 17:01     ` alvin
2015-07-21 23:15 ` Neal P. Murphy
2015-07-22  0:08   ` Sven-Haegar Koch
2015-07-22  0:31     ` Neal P. Murphy [this message]
2015-07-22 13:39   ` Thomas Delrue
2015-07-27 10:25 ` Bastian Bittorf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150721203151.1013534d@playground \
    --to=neal.p.murphy@alum.wpi.edu \
    --cc=haegar@sdinet.de \
    --cc=netfilter@vger.kernel.org \
    --cc=thomas.delrue@fundamental-software.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.