"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/tables.c" between
dnsmasq-2.80.tar.gz and dnsmasq-2.81.tar.xz

About: Dnsmasq is a lightweight caching DNS forwarder and DHCP server.

tables.c  (dnsmasq-2.80):tables.c  (dnsmasq-2.81.tar.xz)
skipping to change at line 64 skipping to change at line 64
void ipset_init(void) void ipset_init(void)
{ {
dev = open( pf_device, O_RDWR); dev = open( pf_device, O_RDWR);
if (dev == -1) if (dev == -1)
{ {
err(1, "%s", pf_device); err(1, "%s", pf_device);
die (_("failed to access pf devices: %s"), NULL, EC_MISC); die (_("failed to access pf devices: %s"), NULL, EC_MISC);
} }
} }
int add_to_ipset(const char *setname, const struct all_addr *ipaddr, int add_to_ipset(const char *setname, const union all_addr *ipaddr,
int flags, int remove) int flags, int remove)
{ {
struct pfr_addr addr; struct pfr_addr addr;
struct pfioc_table io; struct pfioc_table io;
struct pfr_table table; struct pfr_table table;
if (dev == -1) if (dev == -1)
{ {
my_syslog(LOG_ERR, _("warning: no opened pf devices %s"), pf_device); my_syslog(LOG_ERR, _("warning: no opened pf devices %s"), pf_device);
return -1; return -1;
skipping to change at line 110 skipping to change at line 110
my_syslog(LOG_WARNING, _("IPset: error:%s"), pfr_strerror(errno)); my_syslog(LOG_WARNING, _("IPset: error:%s"), pfr_strerror(errno));
return -1; return -1;
} }
table.pfrt_flags &= ~PFR_TFLAG_PERSIST; table.pfrt_flags &= ~PFR_TFLAG_PERSIST;
if (io.pfrio_nadd) if (io.pfrio_nadd)
my_syslog(LOG_INFO, _("info: table created")); my_syslog(LOG_INFO, _("info: table created"));
bzero(&addr, sizeof(addr)); bzero(&addr, sizeof(addr));
#ifdef HAVE_IPV6
if (flags & F_IPV6) if (flags & F_IPV6)
{ {
addr.pfra_af = AF_INET6; addr.pfra_af = AF_INET6;
addr.pfra_net = 0x80; addr.pfra_net = 0x80;
memcpy(&(addr.pfra_ip6addr), &(ipaddr->addr), sizeof(struct in6_addr)); memcpy(&(addr.pfra_ip6addr), ipaddr, sizeof(struct in6_addr));
} }
else else
#endif
{ {
addr.pfra_af = AF_INET; addr.pfra_af = AF_INET;
addr.pfra_net = 0x20; addr.pfra_net = 0x20;
addr.pfra_ip4addr.s_addr = ipaddr->addr.addr4.s_addr; addr.pfra_ip4addr.s_addr = ipaddr->addr4.s_addr;
} }
bzero(&io, sizeof(io)); bzero(&io, sizeof(io));
io.pfrio_flags = 0; io.pfrio_flags = 0;
io.pfrio_table = table; io.pfrio_table = table;
io.pfrio_buffer = &addr; io.pfrio_buffer = &addr;
io.pfrio_esize = sizeof(addr); io.pfrio_esize = sizeof(addr);
io.pfrio_size = 1; io.pfrio_size = 1;
if (ioctl(dev, ( remove ? DIOCRDELADDRS : DIOCRADDADDRS ), &io)) if (ioctl(dev, ( remove ? DIOCRDELADDRS : DIOCRADDADDRS ), &io))
{ {
 End of changes. 5 change blocks. 
5 lines changed or deleted 4 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)