"Fossies" - the Fresh Open Source Software Archive  

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

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

conntrack.c  (dnsmasq-2.80):conntrack.c  (dnsmasq-2.81.tar.xz)
/* dnsmasq is Copyright (c) 2000-2018 Simon Kelley /* dnsmasq is Copyright (c) 2000-2020 Simon Kelley
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 dated June, 1991, or the Free Software Foundation; version 2 dated June, 1991, or
(at your option) version 3 dated 29 June, 2007. (at your option) version 3 dated 29 June, 2007.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
skipping to change at line 27 skipping to change at line 27
#include "dnsmasq.h" #include "dnsmasq.h"
#ifdef HAVE_CONNTRACK #ifdef HAVE_CONNTRACK
#include <libnetfilter_conntrack/libnetfilter_conntrack.h> #include <libnetfilter_conntrack/libnetfilter_conntrack.h>
static int gotit = 0; /* yuck */ static int gotit = 0; /* yuck */
static int callback(enum nf_conntrack_msg_type type, struct nf_conntrack *ct, vo id *data); static int callback(enum nf_conntrack_msg_type type, struct nf_conntrack *ct, vo id *data);
int get_incoming_mark(union mysockaddr *peer_addr, struct all_addr *local_addr, int istcp, unsigned int *markp) int get_incoming_mark(union mysockaddr *peer_addr, union all_addr *local_addr, i nt istcp, unsigned int *markp)
{ {
struct nf_conntrack *ct; struct nf_conntrack *ct;
struct nfct_handle *h; struct nfct_handle *h;
gotit = 0; gotit = 0;
if ((ct = nfct_new())) if ((ct = nfct_new()))
{ {
nfct_set_attr_u8(ct, ATTR_L4PROTO, istcp ? IPPROTO_TCP : IPPROTO_UDP); nfct_set_attr_u8(ct, ATTR_L4PROTO, istcp ? IPPROTO_TCP : IPPROTO_UDP);
nfct_set_attr_u16(ct, ATTR_PORT_DST, htons(daemon->port)); nfct_set_attr_u16(ct, ATTR_PORT_DST, htons(daemon->port));
#ifdef HAVE_IPV6
if (peer_addr->sa.sa_family == AF_INET6) if (peer_addr->sa.sa_family == AF_INET6)
{ {
nfct_set_attr_u8(ct, ATTR_L3PROTO, AF_INET6); nfct_set_attr_u8(ct, ATTR_L3PROTO, AF_INET6);
nfct_set_attr(ct, ATTR_IPV6_SRC, peer_addr->in6.sin6_addr.s6_addr); nfct_set_attr(ct, ATTR_IPV6_SRC, peer_addr->in6.sin6_addr.s6_addr);
nfct_set_attr_u16(ct, ATTR_PORT_SRC, peer_addr->in6.sin6_port); nfct_set_attr_u16(ct, ATTR_PORT_SRC, peer_addr->in6.sin6_port);
nfct_set_attr(ct, ATTR_IPV6_DST, local_addr->addr.addr6.s6_addr); nfct_set_attr(ct, ATTR_IPV6_DST, local_addr->addr6.s6_addr);
} }
else else
#endif
{ {
nfct_set_attr_u8(ct, ATTR_L3PROTO, AF_INET); nfct_set_attr_u8(ct, ATTR_L3PROTO, AF_INET);
nfct_set_attr_u32(ct, ATTR_IPV4_SRC, peer_addr->in.sin_addr.s_addr); nfct_set_attr_u32(ct, ATTR_IPV4_SRC, peer_addr->in.sin_addr.s_addr);
nfct_set_attr_u16(ct, ATTR_PORT_SRC, peer_addr->in.sin_port); nfct_set_attr_u16(ct, ATTR_PORT_SRC, peer_addr->in.sin_port);
nfct_set_attr_u32(ct, ATTR_IPV4_DST, local_addr->addr.addr4.s_addr); nfct_set_attr_u32(ct, ATTR_IPV4_DST, local_addr->addr4.s_addr);
} }
if ((h = nfct_open(CONNTRACK, 0))) if ((h = nfct_open(CONNTRACK, 0)))
{ {
nfct_callback_register(h, NFCT_T_ALL, callback, (void *)markp); nfct_callback_register(h, NFCT_T_ALL, callback, (void *)markp);
if (nfct_query(h, NFCT_Q_GET, ct) == -1) if (nfct_query(h, NFCT_Q_GET, ct) == -1)
{ {
static int warned = 0; static int warned = 0;
if (!warned) if (!warned)
{ {
 End of changes. 6 change blocks. 
6 lines changed or deleted 4 lines changed or added

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