: Netfilter 2.6.23 update
Subsystems (5)
PATCH 46/50 : xt_helper: use RCU
In reply to Patrick McHardy[NETFILTER]: xt_helper: use RCU
The ->helper pointer is protected by RCU, no need to take nf_conntrack_lock. Also remove excessive debugging.
---
commit a427f588c5a2a74926656e0586717479869ff01c
tree 7fd3ea63409d927ba8a7b0006529ddc7310d2062
parent 312f613cf94327c5e48fb0dbcae03f15397258c6
author Patrick McHardy <[email protected]> Sat, 07 Jul 2007 12:16:07 +0200 committer Patrick McHardy <[email protected]> Sat, 07 Jul 2007 12:16:07 +0200
net/netfilter/xt_helper.c | 31 ++++++++----------------------- 1 files changed, 8 insertions(+), 23 deletions(-)
net/netfilter/xt_helper.c +8 -23
@@ -22,11 +22,6 @@ MODULE_DESCRIPTION("iptables helper match module");MODULE_ALIAS ("ipt_helper" );MODULE_ALIAS ("ip6t_helper" ); -#if 0 -#define DEBUGP printk -#else -#define DEBUGP(format, args...) -#endif static bool match(const struct sk_buff *skb,
@@ -41,38 +36,28 @@ match(const struct sk_buff *skb,const struct xt_helper_info *info = matchinfo;const struct nf_conn *ct;const struct nf_conn_help *master_help; +const struct nf_conntrack_helper *helper;enum ip_conntrack_info ctinfo;bool ret = info->invert; ct =nf_ct_get (skb, &ctinfo); -if (!ct) { -DEBUGP ("xt_helper: Eek! invalid conntrack?\n" ); +if (!ct || !ct->master)return ret; - } - -if (!ct->master) { -DEBUGP ("xt_helper: conntrack %p has no master\n" , ct); -return ret; - } -read_lock_bh (&nf_conntrack_lock); master_help =nfct_help (ct->master); -if (!master_help || !master_help->helper) { -DEBUGP ("xt_helper: master ct %p has no helper\n" , - exp->expectant); - goto out_unlock; - } +if (!master_help) +return ret; -DEBUGP ("master's name = %s , info->name = %s\n" , - ct->master->helper->name, info->name); +/* rcu_read_lock()ed by nf_hook_slow */ + helper =rcu_dereference (master_help->helper); +if (!helper) +return ret;if (info->name[0 ] =='\0' ) ret = !ret;else ret ^= !strncmp (master_help->helper->name, info->name,strlen (master_help->helper->name)); -out_unlock: -read_unlock_bh (&nf_conntrack_lock);return ret; }
PATCH 47/50 : Convert DEBUGP to pr_debug
In reply to Patrick McHardy[NETFILTER]: Convert DEBUGP to pr_debug
Convert DEBUGP to pr_debug and fix lots of non-compiling debug statements.
---
commit 6786c212c4a32dccc19cae256b36e80c26640b14
tree e3001575c3ba610137e3eb051617ce118cc15449
parent a427f588c5a2a74926656e0586717479869ff01c
author Patrick McHardy <[email protected]> Sat, 07 Jul 2007 12:16:08 +0200 committer Patrick McHardy <[email protected]> Sat, 07 Jul 2007 12:16:08 +0200
include/linux/netfilter/nf_conntrack_pptp.h | 2 include/net/netfilter/nf_conntrack_tuple.h | 10 + net/ipv4/netfilter/ipt_CLUSTERIP.c | 27 +-- net/ipv4/netfilter/ipt_LOG.c | 12 - net/ipv4/netfilter/ipt_MASQUERADE.c | 10 - net/ipv4/netfilter/ipt_NETMAP.c | 13 -- net/ipv4/netfilter/ipt_REDIRECT.c | 10 - net/ipv4/netfilter/ipt_REJECT.c | 10 - net/ipv4/netfilter/ipt_SAME.c | 53 +++---- net/ipv4/netfilter/ipt_ULOG.c | 35 ++-- net/ipv4/netfilter/ipt_iprange.c | 30 +--- net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c | 22 +-- .../netfilter/nf_conntrack_l3proto_ipv4_compat.c | 6 - net/ipv4/netfilter/nf_conntrack_proto_icmp.c | 22 +-- net/ipv4/netfilter/nf_nat_core.c | 15 +- net/ipv4/netfilter/nf_nat_ftp.c | 14 -- net/ipv4/netfilter/nf_nat_h323.c | 95 ++++++------ net/ipv4/netfilter/nf_nat_helper.c | 40 ++--- net/ipv4/netfilter/nf_nat_irc.c | 13 -- net/ipv4/netfilter/nf_nat_pptp.c | 37 ++--- net/ipv4/netfilter/nf_nat_proto_gre.c | 17 +- net/ipv4/netfilter/nf_nat_rule.c | 14 -- net/ipv4/netfilter/nf_nat_sip.c | 8 - net/ipv4/netfilter/nf_nat_standalone.c | 16 +- net/ipv6/netfilter/ip6t_LOG.c | 12 - net/ipv6/netfilter/ip6t_REJECT.c | 23 +-- net/ipv6/netfilter/ip6t_ah.c | 47 +++--- net/ipv6/netfilter/ip6t_frag.c | 76 ++++----- net/ipv6/netfilter/ip6t_hbh.c | 45 ++---- net/ipv6/netfilter/ip6t_rt.c | 82 +++++----- net/ipv6/netfilter/ip6table_mangle.c | 6 - net/ipv6/netfilter/ip6table_raw.c | 6 - net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c | 10 - net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c | 24 +-- net/ipv6/netfilter/nf_conntrack_reasm.c | 52 +++--- net/netfilter/nf_conntrack_core.c | 41 ++--- net/netfilter/nf_conntrack_ftp.c | 94 ++++++------ net/netfilter/nf_conntrack_h323_main.c | 161 ++++++++++---------- net/netfilter/nf_conntrack_irc.c | 24 +-- net/netfilter/nf_conntrack_l3proto_generic.c | 6 - net/netfilter/nf_conntrack_pptp.c | 71 ++++----- net/netfilter/nf_conntrack_proto_gre.c | 28 +-- net/netfilter/nf_conntrack_proto_sctp.c | 92 ++++------- net/netfilter/nf_conntrack_proto_tcp.c | 129 +++++++--------- net/netfilter/nf_conntrack_sane.c | 27 +-- net/netfilter/nf_conntrack_sip.c | 22 +-- net/netfilter/nf_conntrack_standalone.c | 6 - net/netfilter/nf_conntrack_tftp.c | 17 -- 48 files changed, 662 insertions(+), 970 deletions(-)
include/linux/netfilter/nf_conntrack_pptp.h +2 -0
@@ -4,6 +4,8 @@#include <linux/netfilter/nf_conntrack_common.h> +extern const char *pptp_msg_name[]; +/* state of the control session */ enum pptp_ctrlsess_state {PPTP_SESSION_NONE ,/* no session present */
include/net/netfilter/nf_conntrack_tuple.h +5 -5
@@ -120,11 +120,11 @@ struct nf_conntrack_tuple_mask#ifdef __KERNEL__ -#define NF_CT_DUMP_TUPLE (tp) \ -DEBUGP("tuple %p: %u %u " NIP6_FMT " %hu -> " NIP6_FMT " %hu\n", \ - (tp), (tp)->src.l3num, (tp)->dst.protonum, \ - NIP6(*(struct in6_addr *)(tp)->src.u3.all), ntohs((tp)->src.u.all), \ - NIP6(*(struct in6_addr *)(tp)->dst.u3.all), ntohs((tp)->dst.u.all)) +#define NF_CT_DUMP_TUPLE (tp) \ +pr_debug("tuple %p: %u %u " NIP6_FMT " %hu -> " NIP6_FMT " %hu\n", \ + (tp), (tp)->src.l3num, (tp)->dst.protonum, \ + NIP6(*(struct in6_addr *)(tp)->src.u3.all), ntohs((tp)->src.u.all), \ + NIP6(*(struct in6_addr *)(tp)->dst.u3.all), ntohs((tp)->dst.u.all))/* If we're the first tuple, it's the original dir. */ #define NF_CT_DIRECTION (h) \
net/ipv4/netfilter/ipt_CLUSTERIP.c +10 -17
@@ -30,14 +30,6 @@#define CLUSTERIP_VERSION "0.8" -#define DEBUG_CLUSTERIP - -#ifdef DEBUG_CLUSTERIP -#define DEBUGP printk -#else -#define DEBUGP -#endif -MODULE_LICENSE ("GPL" );MODULE_AUTHOR ("Harald Welte <[email protected]>" );MODULE_DESCRIPTION ("iptables target for CLUSTERIP" );
@@ -351,15 +343,15 @@ target(struct sk_buff **pskb,break ; } -#ifdef DEBUG_CLUSTERP +#ifdef DEBUG DUMP_TUPLE (&ct->tuplehash[IP_CT_DIR_ORIGINAL ].tuple);#endif -DEBUGP ("hash=%u ct_hash=%u " , hash, ct->mark); +pr_debug ("hash=%u ct_hash=%u " , hash, ct->mark);if (!clusterip_responsible (cipinfo->config, hash)) { -DEBUGP ("not responsible\n" ); +pr_debug ("not responsible\n" );return NF_DROP ; } -DEBUGP ("responsible\n" ); +pr_debug ("responsible\n" );/* despite being received via linklayer multicast, this is * actually a unicast IP packet. TCP doesn't like PACKET_MULTICAST */
@@ -490,7 +482,7 @@ struct arp_payload {__be32 dst_ip; } __attribute__ ((packed)); -#ifdef CLUSTERIP_DEBUG +#ifdef DEBUG static void arp_print (struct arp_payload *payload) {#define HBUFFERLEN 30
@@ -546,8 +538,9 @@ arp_mangle(unsigned int hook,* this wouldn't work, since we didn't subscribe the mcast group on * other interfaces */ if (c->dev != out) { -DEBUGP ("CLUSTERIP: not mangling arp reply on different " -"interface: cip'%s'-skb'%s'\n" , c->dev->name, out->name); +pr_debug ("CLUSTERIP: not mangling arp reply on different " +"interface: cip'%s'-skb'%s'\n" , + c->dev->name, out->name);clusterip_config_put (c);return NF_ACCEPT ; }
@@ -555,8 +548,8 @@ arp_mangle(unsigned int hook,/* mangle reply hardware address */ memcpy (payload->src_hw, c->clustermac, arp->ar_hln); -#ifdef CLUSTERIP_DEBUG -DEBUGP (KERN_DEBUG "CLUSTERIP mangled arp reply: " ); +#ifdef DEBUG +pr_debug (KERN_DEBUG "CLUSTERIP mangled arp reply: " );arp_print (payload);#endif
net/ipv4/netfilter/ipt_LOG.c +3 -9
@@ -27,12 +27,6 @@ MODULE_LICENSE("GPL");MODULE_AUTHOR ("Netfilter Core Team <[email protected]>" );MODULE_DESCRIPTION ("iptables syslog logging module" ); -#if 0 -#define DEBUGP printk -#else -#define DEBUGP(format, args...) -#endif -/* Use lock to serialize, so printks don't overlap */ static DEFINE_SPINLOCK (log_lock);
@@ -452,12 +446,12 @@ static bool ipt_log_checkentry(const char *tablename,const struct ipt_log_info *loginfo = targinfo;if (loginfo->level >=8 ) { -DEBUGP ("LOG: level %u >= 8\n" , loginfo->level); +pr_debug ("LOG: level %u >= 8\n" , loginfo->level);return false; }if (loginfo->prefix[sizeof (loginfo->prefix)-1 ] !='\0' ) { -DEBUGP ("LOG: prefix term %i\n" , - loginfo->prefix[sizeof (loginfo->prefix)-1 ]); +pr_debug ("LOG: prefix term %i\n" , + loginfo->prefix[sizeof (loginfo->prefix)-1 ]);return false; }return true;
net/ipv4/netfilter/ipt_MASQUERADE.c +2 -8
@@ -27,12 +27,6 @@ MODULE_LICENSE("GPL");MODULE_AUTHOR ("Netfilter Core Team <[email protected]>" );MODULE_DESCRIPTION ("iptables MASQUERADE target module" ); -#if 0 -#define DEBUGP printk -#else -#define DEBUGP(format, args...) -#endif -/* Lock protects masq region inside conntrack */ static DEFINE_RWLOCK (masq_lock);
@@ -47,11 +41,11 @@ masquerade_check(const char *tablename,const struct nf_nat_multi_range_compat *mr = targinfo;if (mr->range[0 ].flags &IP_NAT_RANGE_MAP_IPS ) { -DEBUGP ("masquerade_check: bad MAP_IPS.\n" ); +pr_debug ("masquerade_check: bad MAP_IPS.\n" );return false; }if (mr->rangesize !=1 ) { -DEBUGP ("masquerade_check: bad rangesize %u.\n" , mr->rangesize); +pr_debug ("masquerade_check: bad rangesize %u\n" , mr->rangesize);return false; }return true;
net/ipv4/netfilter/ipt_NETMAP.c +3 -10
@@ -18,17 +18,10 @@#include <linux/netfilter/x_tables.h> #include <net/netfilter/nf_nat_rule.h> -#define MODULENAME "NETMAP"MODULE_LICENSE ("GPL" );MODULE_AUTHOR ("Svenning Soerensen <[email protected]>" );MODULE_DESCRIPTION ("iptables 1:1 NAT mapping of IP networks target" ); -#if 0 -#define DEBUGP printk -#else -#define DEBUGP(format, args...) -#endif - static bool check(const char *tablename, const void *e,
@@ -39,11 +32,11 @@ check(const char *tablename,const struct nf_nat_multi_range_compat *mr = targinfo;if (!(mr->range[0 ].flags &IP_NAT_RANGE_MAP_IPS )) { -DEBUGP (MODULENAME ":check: bad MAP_IPS.\n" ); +pr_debug ("NETMAP:check: bad MAP_IPS.\n" );return false; }if (mr->rangesize !=1 ) { -DEBUGP (MODULENAME ":check: bad rangesize %u.\n" , mr->rangesize); +pr_debug ("NETMAP:check: bad rangesize %u.\n" , mr->rangesize);return false; }return true;
@@ -86,7 +79,7 @@ target(struct sk_buff **pskb, }static struct xt_target target_module__read_mostly = { - .name =MODULENAME , + .name ="NETMAP" , .family =AF_INET , .target = target, .targetsize =sizeof (struct nf_nat_multi_range_compat ),
net/ipv4/netfilter/ipt_REDIRECT.c +2 -8
@@ -25,12 +25,6 @@ MODULE_LICENSE("GPL");MODULE_AUTHOR ("Netfilter Core Team <[email protected]>" );MODULE_DESCRIPTION ("iptables REDIRECT target module" ); -#if 0 -#define DEBUGP printk -#else -#define DEBUGP(format, args...) -#endif -/* FIXME: Take multiple ranges --RR */ static bool redirect_check(const char *tablename,
@@ -42,11 +36,11 @@ redirect_check(const char *tablename,const struct nf_nat_multi_range_compat *mr = targinfo;if (mr->range[0 ].flags &IP_NAT_RANGE_MAP_IPS ) { -DEBUGP ("redirect_check: bad MAP_IPS.\n" ); +pr_debug ("redirect_check: bad MAP_IPS.\n" );return false; }if (mr->rangesize !=1 ) { -DEBUGP ("redirect_check: bad rangesize %u.\n" , mr->rangesize); +pr_debug ("redirect_check: bad rangesize %u.\n" , mr->rangesize);return false; }return true;
net/ipv4/netfilter/ipt_REJECT.c +2 -8
@@ -31,12 +31,6 @@ MODULE_LICENSE("GPL");MODULE_AUTHOR ("Netfilter Core Team <[email protected]>" );MODULE_DESCRIPTION ("iptables REJECT target module" ); -#if 0 -#define DEBUGP printk -#else -#define DEBUGP(format, args...) -#endif -/* Send RST reply */ static void send_reset (struct sk_buff *oldskb,int hook) {
@@ -227,13 +221,13 @@ static bool check(const char *tablename,const struct ipt_entry *e = e_void;if (rejinfo->with ==IPT_ICMP_ECHOREPLY ) { -printk ("REJECT: ECHOREPLY no longer supported.\n" ); +printk ("ipt_REJECT: ECHOREPLY no longer supported.\n" );return false; }else if (rejinfo->with ==IPT_TCP_RESET ) {/* Must specify that it's a TCP packet */ if (e->ip.proto !=IPPROTO_TCP || (e->ip.invflags &XT_INV_PROTO )) { -DEBUGP ("REJECT: TCP_RESET invalid for non-tcp\n" ); +printk ("ipt_REJECT: TCP_RESET invalid for non-tcp\n" );return false; } }
net/ipv4/netfilter/ipt_SAME.c +22 -31
106 lines not on this page · raw message
net/ipv4/netfilter/ipt_ULOG.c +14 -21
@@ -55,13 +55,6 @@ MODULE_ALIAS_NET_PF_PROTO(PF_NETLINK, NETLINK_NFLOG);#define ULOG_NL_EVENT 111/* Harald's favorite number */ #define ULOG_MAXNLGROUPS 32/* numer of nlgroups */ -#if 0 -#define DEBUGP(format, args...) printk("%s:%s:" format, \ - __FILE__, __FUNCTION__ , ## args) -#else -#define DEBUGP(format, args...) -#endif - #define PRINTR(format, args...) do { if (net_ratelimit()) printk(format , ## args); } while (0)static unsigned int nlbufsiz =NLMSG_GOODSIZE ;
@@ -96,12 +89,12 @@ static void ulog_send(unsigned int nlgroupnum)ulog_buff_t *ub = &ulog_buffers[nlgroupnum];if (timer_pending (&ub->timer)) { -DEBUGP ("ipt_ULOG: ulog_send: timer was pending, deleting\n" ); +pr_debug ("ipt_ULOG: ulog_send: timer was pending, deleting\n" );del_timer (&ub->timer); }if (!ub->skb) { -DEBUGP ("ipt_ULOG: ulog_send: nothing to send\n" ); +pr_debug ("ipt_ULOG: ulog_send: nothing to send\n" );return ; }
@@ -110,8 +103,8 @@ static void ulog_send(unsigned int nlgroupnum) ub->lastnlh->nlmsg_type =NLMSG_DONE ;NETLINK_CB (ub->skb).dst_group = nlgroupnum +1 ; -DEBUGP ("ipt_ULOG: throwing %d packets to netlink group %u\n" , - ub->qlen, nlgroupnum +1 ); +pr_debug ("ipt_ULOG: throwing %d packets to netlink group %u\n" , + ub->qlen, nlgroupnum +1 );netlink_broadcast (nflognl, ub->skb,0 , nlgroupnum +1 ,GFP_ATOMIC ); ub->qlen =0 ;
@@ -123,7 +116,7 @@ static void ulog_send(unsigned int nlgroupnum)/* timer function to flush queue in flushtimeout time */ static void ulog_timer (unsigned long data) { -DEBUGP ("ipt_ULOG: timer function called, calling ulog_send\n" ); +pr_debug ("ipt_ULOG: timer function called, calling ulog_send\n" );/* lock to protect against somebody modifying our structure * from ipt_ulog_target at the same time */
@@ -204,8 +197,8 @@ static void ipt_ulog_packet(unsigned int hooknum, goto alloc_failure; } -DEBUGP ("ipt_ULOG: qlen %d, qthreshold %d\n" , ub->qlen, - loginfo->qthreshold); +pr_debug ("ipt_ULOG: qlen %d, qthreshold %Zu\n" , ub->qlen, + loginfo->qthreshold);/* NLMSG_PUT contains a hidden goto nlmsg_failure !!! */ nlh = NLMSG_PUT(ub->skb, 0, ub->qlen, ULOG_NL_EVENT,
@@ -334,13 +327,13 @@ static bool ipt_ulog_checkentry(const char *tablename,const struct ipt_ulog_info *loginfo = targinfo;if (loginfo->prefix[sizeof (loginfo->prefix) -1 ] !='\0' ) { -DEBUGP ("ipt_ULOG: prefix term %i\n" , - loginfo->prefix[sizeof (loginfo->prefix) -1 ]); +pr_debug ("ipt_ULOG: prefix term %i\n" , + loginfo->prefix[sizeof (loginfo->prefix) -1 ]);return false; }if (loginfo->qthreshold >ULOG_MAX_QLEN ) { -DEBUGP ("ipt_ULOG: queue threshold %i > MAX_QLEN\n" , - loginfo->qthreshold); +pr_debug ("ipt_ULOG: queue threshold %Zu > MAX_QLEN\n" , + loginfo->qthreshold);return false; }return true;
@@ -405,7 +398,7 @@ static int __init ipt_ulog_init(void) {int ret, i; -DEBUGP ("ipt_ULOG: init module\n" ); +pr_debug ("ipt_ULOG: init module\n" );if (nlbufsiz >128 *1024 ) {printk ("Netlink buffer has to be <= 128kB\n" );
@@ -437,7 +430,7 @@ static void __exit ipt_ulog_fini(void)ulog_buff_t *ub;int i; -DEBUGP ("ipt_ULOG: cleanup_module\n" ); +pr_debug ("ipt_ULOG: cleanup_module\n" );if (nflog)nf_log_unregister (&ipt_ulog_logger);
@@ -448,7 +441,7 @@ static void __exit ipt_ulog_fini(void)for (i =0 ; i <ULOG_MAXNLGROUPS ; i++) { ub = &ulog_buffers[i];if (timer_pending (&ub->timer)) { -DEBUGP ("timer was pending, deleting\n" ); +pr_debug ("timer was pending, deleting\n" );del_timer (&ub->timer); }
net/ipv4/netfilter/ipt_iprange.c +12 -18
@@ -17,12 +17,6 @@ MODULE_LICENSE("GPL");MODULE_AUTHOR ("Jozsef Kadlecsik <[email protected]>" );MODULE_DESCRIPTION ("iptables arbitrary IP range match module" ); -#if 0 -#define DEBUGP printk -#else -#define DEBUGP(format, args...) -#endif - static bool match(const struct sk_buff *skb, const struct net_device *in,
@@ -38,12 +32,12 @@ match(const struct sk_buff *skb,if ((ntohl (iph->saddr) <ntohl (info->src.min_ip) ||ntohl (iph->saddr) >ntohl (info->src.max_ip)) ^ !!(info->flags &IPRANGE_SRC_INV )) { -DEBUGP ("src IP %u.%u.%u.%u NOT in range %s" -"%u.%u.%u.%u-%u.%u.%u.%u\n" , -NIPQUAD (iph->saddr), - info->flags &IPRANGE_SRC_INV ?"(INV) " :"" , -NIPQUAD (info->src.min_ip), -NIPQUAD (info->src.max_ip)); +pr_debug ("src IP %u.%u.%u.%u NOT in range %s" +"%u.%u.%u.%u-%u.%u.%u.%u\n" , +NIPQUAD (iph->saddr), + info->flags &IPRANGE_SRC_INV ?"(INV) " :"" , +NIPQUAD (info->src.min_ip), +NIPQUAD (info->src.max_ip));return false; } }
@@ -51,12 +45,12 @@ match(const struct sk_buff *skb,if ((ntohl (iph->daddr) <ntohl (info->dst.min_ip) ||ntohl (iph->daddr) >ntohl (info->dst.max_ip)) ^ !!(info->flags &IPRANGE_DST_INV )) { -DEBUGP ("dst IP %u.%u.%u.%u NOT in range %s" -"%u.%u.%u.%u-%u.%u.%u.%u\n" , -NIPQUAD (iph->daddr), - info->flags &IPRANGE_DST_INV ?"(INV) " :"" , -NIPQUAD (info->dst.min_ip), -NIPQUAD (info->dst.max_ip)); +pr_debug ("dst IP %u.%u.%u.%u NOT in range %s" +"%u.%u.%u.%u-%u.%u.%u.%u\n" , +NIPQUAD (iph->daddr), + info->flags &IPRANGE_DST_INV ?"(INV) " :"" , +NIPQUAD (info->dst.min_ip), +NIPQUAD (info->dst.max_ip));return false; } }
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c +8 -14
@@ -24,12 +24,6 @@#include <net/netfilter/nf_conntrack_core.h> #include <net/netfilter/ipv4/nf_conntrack_ipv4.h> -#if 0 -#define DEBUGP printk -#else -#define DEBUGP(format, args...) -#endif -static int ipv4_pkt_to_tuple (const struct sk_buff *skb,unsigned int nhoff,struct nf_conntrack_tuple *tuple) {
@@ -324,13 +318,13 @@ getorigdst(struct sock *sk, int optval, void __user *user, int *len)/* We only do TCP at the moment: is there a better way? */ if (strcmp (sk->sk_prot->name,"TCP" )) { -DEBUGP ("SO_ORIGINAL_DST: Not a TCP socket\n" ); +pr_debug ("SO_ORIGINAL_DST: Not a TCP socket\n" );return -ENOPROTOOPT ; }if ((unsigned int ) *len <sizeof (struct sockaddr_in )) { -DEBUGP ("SO_ORIGINAL_DST: len %u not %u\n" , - *len,sizeof (struct sockaddr_in )); +pr_debug ("SO_ORIGINAL_DST: len %d not %Zu\n" , + *len,sizeof (struct sockaddr_in ));return -EINVAL ; }
@@ -346,17 +340,17 @@ getorigdst(struct sock *sk, int optval, void __user *user, int *len) .tuple.dst.u3.ip;memset (sin.sin_zero,0 ,sizeof (sin.sin_zero)); -DEBUGP ("SO_ORIGINAL_DST: %u.%u.%u.%u %u\n" , -NIPQUAD (sin.sin_addr.s_addr),ntohs (sin.sin_port)); +pr_debug ("SO_ORIGINAL_DST: %u.%u.%u.%u %u\n" , +NIPQUAD (sin.sin_addr.s_addr),ntohs (sin.sin_port));nf_ct_put (ct);if (copy_to_user (user, &sin,sizeof (sin)) !=0 )return -EFAULT ;else return 0 ; } -DEBUGP ("SO_ORIGINAL_DST: Can't find %u.%u.%u.%u/%u-%u.%u.%u.%u/%u.\n" , -NIPQUAD (tuple.src.u3.ip),ntohs (tuple.src.u.tcp.port), -NIPQUAD (tuple.dst.u3.ip),ntohs (tuple.dst.u.tcp.port)); +pr_debug ("SO_ORIGINAL_DST: Can't find %u.%u.%u.%u/%u-%u.%u.%u.%u/%u.\n" , +NIPQUAD (tuple.src.u3.ip),ntohs (tuple.src.u.tcp.port), +NIPQUAD (tuple.dst.u3.ip),ntohs (tuple.dst.u.tcp.port));return -ENOENT ; }
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c +0 -6
@@ -18,12 +18,6 @@#include <net/netfilter/nf_conntrack_l4proto.h> #include <net/netfilter/nf_conntrack_expect.h> -#if 0 -#define DEBUGP printk -#else -#define DEBUGP(format, args...) -#endif -#ifdef CONFIG_NF_CT_ACCT static unsigned int seq_print_counters(struct seq_file *s,
net/ipv4/netfilter/nf_conntrack_proto_icmp.c +8 -14
@@ -21,12 +21,6 @@static unsigned long nf_ct_icmp_timeout__read_mostly =30 *HZ ; -#if 0 -#define DEBUGP printk -#else -#define DEBUGP(format, args...) -#endif -static int icmp_pkt_to_tuple (const struct sk_buff *skb,unsigned int dataoff,struct nf_conntrack_tuple *tuple)
@@ -125,8 +119,8 @@ static int icmp_new(struct nf_conn *conntrack,if (conntrack->tuplehash[0 ].tuple.dst.u.icmp.type >=sizeof (valid_new) || !valid_new[conntrack->tuplehash[0 ].tuple.dst.u.icmp.type]) {/* Can't create a new ICMP `conn' with this. */ -DEBUGP ("icmp: can't create new conn with type %u\n" , - conntrack->tuplehash[0 ].tuple.dst.u.icmp.type); +pr_debug ("icmp: can't create new conn with type %u\n" , + conntrack->tuplehash[0 ].tuple.dst.u.icmp.type);NF_CT_DUMP_TUPLE (&conntrack->tuplehash[0 ].tuple);return 0 ; }
@@ -159,8 +153,8 @@ icmp_error_message(struct sk_buff *skb,/* Ignore ICMP's containing fragments (shouldn't happen) */ if (inside->ip.frag_off &htons (IP_OFFSET )) { -DEBUGP ("icmp_error_message: fragment of proto %u\n" , - inside->ip.protocol); +pr_debug ("icmp_error_message: fragment of proto %u\n" , + inside->ip.protocol);return -NF_ACCEPT ; }
@@ -172,8 +166,8 @@ icmp_error_message(struct sk_buff *skb,if (!nf_ct_get_tuple (skb, dataoff, dataoff + inside->ip.ihl*4 ,PF_INET , inside->ip.protocol, &origtuple, &nf_conntrack_l3proto_ipv4, innerproto)) { -DEBUGP ("icmp_error_message: ! get_tuple p=%u" , - inside->ip.protocol); +pr_debug ("icmp_error_message: ! get_tuple p=%u" , + inside->ip.protocol);return -NF_ACCEPT ; }
@@ -181,7 +175,7 @@ icmp_error_message(struct sk_buff *skb,been preserved inside the ICMP. */ if (!nf_ct_invert_tuple (&innertuple, &origtuple, &nf_conntrack_l3proto_ipv4, innerproto)) { -DEBUGP ("icmp_error_message: no match\n" ); +pr_debug ("icmp_error_message: no match\n" );return -NF_ACCEPT ; }
@@ -196,7 +190,7 @@ icmp_error_message(struct sk_buff *skb, h =nf_conntrack_find_get (&origtuple);if (!h) { -DEBUGP ("icmp_error_message: no match\n" ); +pr_debug ("icmp_error_message: no match\n" );return -NF_ACCEPT ; }
net/ipv4/netfilter/nf_nat_core.c +5 -10
@@ -31,12 +31,6 @@#include <net/netfilter/nf_conntrack_l3proto.h> #include <net/netfilter/nf_conntrack_l4proto.h> -#if 0 -#define DEBUGP printk -#else -#define DEBUGP(format, args...) -#endif -static DEFINE_RWLOCK (nf_nat_lock);static struct nf_conntrack_l3proto *l3proto =NULL ;
@@ -242,7 +236,7 @@ get_unique_tuple(struct nf_conntrack_tuple *tuple,manips not an issue. */ if (maniptype ==IP_NAT_MANIP_SRC ) {if (find_appropriate_src (orig_tuple, tuple, range)) { -DEBUGP ("get_unique_tuple: Found current src map\n" ); +pr_debug ("get_unique_tuple: Found current src map\n" );if (!(range->flags &IP_NAT_RANGE_PROTO_RANDOM ))if (!nf_nat_used_tuple (tuple, ct))return ;
@@ -293,7 +287,7 @@ nf_nat_setup_info(struct nf_conn *ct,if (!nat) { nat =nf_ct_ext_add (ct,NF_CT_EXT_NAT ,GFP_ATOMIC );if (nat ==NULL ) { -DEBUGP ("failed to add NAT extension\n" ); +pr_debug ("failed to add NAT extension\n" );return NF_ACCEPT ; } }
@@ -462,8 +456,9 @@ int nf_nat_icmp_reply_translation(struct nf_conn *ct,return 0 ; } -DEBUGP ("icmp_reply_translation: translating error %p manp %u dir %s\n" , - *pskb, manip, dir ==IP_CT_DIR_ORIGINAL ?"ORIG" :"REPLY" ); +pr_debug ("icmp_reply_translation: translating error %p manip %u " +"dir %s\n" , *pskb, manip, + dir ==IP_CT_DIR_ORIGINAL ?"ORIG" :"REPLY" );/* rcu_read_lock()ed by nf_hook_slow */ l4proto =__nf_ct_l4proto_find (PF_INET , inside->ip.protocol);
net/ipv4/netfilter/nf_nat_ftp.c +4 -10
@@ -25,12 +25,6 @@ MODULE_AUTHOR("Rusty Russell <[email protected]>");MODULE_DESCRIPTION ("ftp NAT helper" );MODULE_ALIAS ("ip_nat_ftp" ); -#if 0 -#define DEBUGP printk -#else -#define DEBUGP(format, args...) -#endif -/* FIXME: Time out? --RR */ static int
@@ -47,7 +41,7 @@ mangle_rfc959_packet(struct sk_buff **pskb,sprintf (buffer,"%u,%u,%u,%u,%u,%u" ,NIPQUAD (newip), port>>8 , port&0xFF ); -DEBUGP ("calling nf_nat_mangle_tcp_packet\n" ); +pr_debug ("calling nf_nat_mangle_tcp_packet\n" );return nf_nat_mangle_tcp_packet (pskb, ct, ctinfo, matchoff, matchlen, buffer,strlen (buffer));
@@ -67,7 +61,7 @@ mangle_eprt_packet(struct sk_buff **pskb,sprintf (buffer,"|1|%u.%u.%u.%u|%u|" ,NIPQUAD (newip), port); -DEBUGP ("calling nf_nat_mangle_tcp_packet\n" ); +pr_debug ("calling nf_nat_mangle_tcp_packet\n" );return nf_nat_mangle_tcp_packet (pskb, ct, ctinfo, matchoff, matchlen, buffer,strlen (buffer));
@@ -87,7 +81,7 @@ mangle_epsv_packet(struct sk_buff **pskb,sprintf (buffer,"|||%u|" , port); -DEBUGP ("calling nf_nat_mangle_tcp_packet\n" ); +pr_debug ("calling nf_nat_mangle_tcp_packet\n" );return nf_nat_mangle_tcp_packet (pskb, ct, ctinfo, matchoff, matchlen, buffer,strlen (buffer));
@@ -117,7 +111,7 @@ static unsigned int nf_nat_ftp(struct sk_buff **pskb,int dir =CTINFO2DIR (ctinfo);struct nf_conn *ct = exp->master; -DEBUGP ("FTP_NAT: type %i, off %u len %u\n" , type, matchoff, matchlen); +pr_debug ("FTP_NAT: type %i, off %u len %u\n" , type, matchoff, matchlen);/* Connection will come from wherever this packet goes, hence !dir */ newip = ct->tuplehash[!dir].tuple.dst.u3.ip;
net/ipv4/netfilter/nf_nat_h323.c +46 -49
155 lines not on this page · raw message
net/ipv4/netfilter/nf_nat_helper.c +17 -23
@@ -26,13 +26,9 @@#include <net/netfilter/nf_nat_core.h> #include <net/netfilter/nf_nat_helper.h> -#if 0 -#define DEBUGP printk -#define DUMP_OFFSET (x) printk("offset_before=%d, offset_after=%d, correction_pos=%u\n", x->offset_before, x->offset_after, x->correction_pos); -#else -#define DEBUGP(format, args...) -#define DUMP_OFFSET (x) -#endif +#define DUMP_OFFSET (x) \ + pr_debug("offset_before=%d, offset_after=%d, correction_pos=%u\n", \ + x->offset_before, x->offset_after, x->correction_pos);static DEFINE_SPINLOCK (nf_nat_seqofs_lock);
@@ -47,15 +43,15 @@ adjust_tcp_sequence(u32 seq,struct nf_nat_seq *this_way, *other_way;struct nf_conn_nat *nat =nfct_nat (ct); -DEBUGP ("nf_nat_resize_packet: old_size = %u, new_size = %u\n" , - (*skb)->len, new_size); +pr_debug ("adjust_tcp_sequence: seq = %u, sizediff = %d\n" , +ntohl (seq), seq); dir =CTINFO2DIR (ctinfo); this_way = &nat->seq[dir]; other_way = &nat->seq[!dir]; -DEBUGP ("nf_nat_resize_packet: Seq_offset before: " ); +pr_debug ("nf_nat_resize_packet: Seq_offset before: " );DUMP_OFFSET (this_way);spin_lock_bh (&nf_nat_seqofs_lock);
@@ -72,7 +68,7 @@ adjust_tcp_sequence(u32 seq, }spin_unlock_bh (&nf_nat_seqofs_lock); -DEBUGP ("nf_nat_resize_packet: Seq_offset after: " ); +pr_debug ("nf_nat_resize_packet: Seq_offset after: " );DUMP_OFFSET (this_way); }
@@ -100,14 +96,12 @@ static void mangle_contents(struct sk_buff *skb,/* update skb info */ if (rep_len > match_len) { -DEBUGP ("nf_nat_mangle_packet: Extending packet by " -"%u from %u bytes\n" , rep_len - match_len, - skb->len); +pr_debug ("nf_nat_mangle_packet: Extending packet by " +"%u from %u bytes\n" , rep_len - match_len, skb->len);skb_put (skb, rep_len - match_len); }else { -DEBUGP ("nf_nat_mangle_packet: Shrinking packet from " -"%u from %u bytes\n" , match_len - rep_len, - skb->len); +pr_debug ("nf_nat_mangle_packet: Shrinking packet from " +"%u from %u bytes\n" , match_len - rep_len, skb->len);__skb_trim (skb, skb->len + rep_len - match_len); }
@@ -320,9 +314,9 @@ sack_adjust(struct sk_buff *skb, new_end_seq =htonl (ntohl (sack->end_seq) - natseq->offset_before); -DEBUGP ("sack_adjust: start_seq: %d->%d, end_seq: %d->%d\n" , -ntohl (sack->start_seq), new_start_seq, -ntohl (sack->end_seq), new_end_seq); +pr_debug ("sack_adjust: start_seq: %d->%d, end_seq: %d->%d\n" , +ntohl (sack->start_seq), new_start_seq, +ntohl (sack->end_seq), new_end_seq);nf_proto_csum_replace4 (&tcph->check, skb, sack->start_seq, new_start_seq,0 );
@@ -414,9 +408,9 @@ nf_nat_seq_adjust(struct sk_buff **pskb,nf_proto_csum_replace4 (&tcph->check, *pskb, tcph->seq, newseq,0 );nf_proto_csum_replace4 (&tcph->check, *pskb, tcph->ack_seq, newack,0 ); -DEBUGP ("Adjusting sequence number from %u->%u, ack from %u->%u\n" , -ntohl (tcph->seq),ntohl (newseq),ntohl (tcph->ack_seq), -ntohl (newack)); +pr_debug ("Adjusting sequence number from %u->%u, ack from %u->%u\n" , +ntohl (tcph->seq),ntohl (newseq),ntohl (tcph->ack_seq), +ntohl (newack)); tcph->seq = newseq; tcph->ack_seq = newack;
net/ipv4/netfilter/nf_nat_irc.c +2 -11
@@ -22,12 +22,6 @@#include <net/netfilter/nf_conntrack_expect.h> #include <linux/netfilter/nf_conntrack_irc.h> -#if 0 -#define DEBUGP printk -#else -#define DEBUGP(format, args...) -#endif -MODULE_AUTHOR ("Harald Welte <[email protected]>" );MODULE_DESCRIPTION ("IRC (DCC) NAT helper" );MODULE_LICENSE ("GPL" );
@@ -44,9 +38,6 @@ static unsigned int help(struct sk_buff **pskb,u_int16_t port;unsigned int ret; -DEBUGP ("IRC_NAT: info (seq %u + %u) in %u\n" , - expect->seq, exp_irc_info->len,ntohl (tcph->seq)); -/* Reply comes from server. */ exp->saved_proto.tcp.port = exp->tuple.dst.u.tcp.port; exp->dir =IP_CT_DIR_REPLY ;
@@ -64,8 +55,8 @@ static unsigned int help(struct sk_buff **pskb, ip =ntohl (exp->master->tuplehash[IP_CT_DIR_REPLY ].tuple.dst.u3.ip);sprintf (buffer,"%u %u" , ip, port); -DEBUGP ("nf_nat_irc: inserting '%s' == %u.%u.%u.%u, port %u\n" , - buffer,NIPQUAD (ip), port); +pr_debug ("nf_nat_irc: inserting '%s' == %u.%u.%u.%u, port %u\n" , + buffer,NIPQUAD (ip), port); ret = nf_nat_mangle_tcp_packet(pskb, exp->master, ctinfo, matchoff, matchlen, buffer,
net/ipv4/netfilter/nf_nat_pptp.c +15 -22
@@ -37,14 +37,6 @@ MODULE_AUTHOR("Harald Welte <[email protected]>");MODULE_DESCRIPTION ("Netfilter NAT helper module for PPTP" );MODULE_ALIAS ("ip_nat_pptp" ); -#if 0 -extern const char *pptp_msg_name[]; -#define DEBUGP(format, args...) printk(KERN_DEBUG "%s:%s: " format, __FILE__, \ - __FUNCTION__, ## args) -#else -#define DEBUGP(format, args...) -#endif -static void pptp_nat_expected (struct nf_conn *ct,struct nf_conntrack_expect *exp) {
@@ -60,7 +52,7 @@ static void pptp_nat_expected(struct nf_conn *ct,/* And here goes the grand finale of corrosion... */ if (exp->dir ==IP_CT_DIR_ORIGINAL ) { -DEBUGP ("we are PNS->PAC\n" ); +pr_debug ("we are PNS->PAC\n" );/* therefore, build tuple for PAC->PNS */ t.src.l3num =AF_INET ; t.src.u3.ip = master->tuplehash[!exp->dir].tuple.src.u3.ip;
@@ -69,7 +61,7 @@ static void pptp_nat_expected(struct nf_conn *ct, t.dst.u.gre.key = ct_pptp_info->pns_call_id; t.dst.protonum =IPPROTO_GRE ; }else { -DEBUGP ("we are PAC->PNS\n" ); +pr_debug ("we are PAC->PNS\n" );/* build tuple for PNS->PAC */ t.src.l3num =AF_INET ; t.src.u3.ip = master->tuplehash[!exp->dir].tuple.src.u3.ip;
@@ -79,15 +71,15 @@ static void pptp_nat_expected(struct nf_conn *ct, t.dst.protonum =IPPROTO_GRE ; } -DEBUGP ("trying to unexpect other dir: " ); +pr_debug ("trying to unexpect other dir: " );NF_CT_DUMP_TUPLE (&t); other_exp =nf_ct_expect_find_get (&t);if (other_exp) {nf_ct_unexpect_related (other_exp);nf_ct_expect_put (other_exp); -DEBUGP ("success\n" ); +pr_debug ("success\n" ); }else { -DEBUGP ("not found!\n" ); +pr_debug ("not found!\n" ); }/* This must be a fresh one. */
@@ -161,9 +153,9 @@ pptp_outbound_pkt(struct sk_buff **pskb, cid_off = offsetof(union pptp_ctrl_union, clrreq.callID);break ;default : -DEBUGP ("unknown outbound packet 0x%04x:%s\n" , msg, - (msg <=PPTP_MSG_MAX )? - pptp_msg_name[msg]:pptp_msg_name[0 ]); +pr_debug ("unknown outbound packet 0x%04x:%s\n" , msg, + msg <=PPTP_MSG_MAX ? pptp_msg_name[msg] : + pptp_msg_name[0 ]);/* fall through */ case PPTP_SET_LINK_INFO :/* only need to NAT in case PAC is behind NAT box */
@@ -179,8 +171,8 @@ pptp_outbound_pkt(struct sk_buff **pskb,/* only OUT_CALL_REQUEST, IN_CALL_REPLY, CALL_CLEAR_REQUEST pass * down to here */ -DEBUGP ("altering call id from 0x%04x to 0x%04x\n" , -ntohs (REQ_CID (pptpReq, cid_off)),ntohs (new_callid)); +pr_debug ("altering call id from 0x%04x to 0x%04x\n" , +ntohs (REQ_CID (pptpReq, cid_off)),ntohs (new_callid));/* mangle packet */ if (nf_nat_mangle_tcp_packet(pskb, ct, ctinfo,
@@ -255,8 +247,9 @@ pptp_inbound_pkt(struct sk_buff **pskb, pcid_off = offsetof(union pptp_ctrl_union, setlink.peersCallID);break ;default : -DEBUGP ("unknown inbound packet %s\n" , (msg <=PPTP_MSG_MAX )? - pptp_msg_name[msg]:pptp_msg_name[0 ]); +pr_debug ("unknown inbound packet %s\n" , + msg <=PPTP_MSG_MAX ? pptp_msg_name[msg] : + pptp_msg_name[0 ]);/* fall through */ case PPTP_START_SESSION_REQUEST :case PPTP_START_SESSION_REPLY :
@@ -272,8 +265,8 @@ pptp_inbound_pkt(struct sk_buff **pskb,* WAN_ERROR_NOTIFY, CALL_DISCONNECT_NOTIFY pass down here */ /* mangle packet */ -DEBUGP ("altering peer call id from 0x%04x to 0x%04x\n" , -ntohs (REQ_CID (pptpReq, pcid_off)),ntohs (new_pcid)); +pr_debug ("altering peer call id from 0x%04x to 0x%04x\n" , +ntohs (REQ_CID (pptpReq, pcid_off)),ntohs (new_pcid)); if (nf_nat_mangle_tcp_packet(pskb, ct, ctinfo, pcid_off + sizeof(struct pptp_pkt_hdr) +
net/ipv4/netfilter/nf_nat_proto_gre.c +5 -12
@@ -36,13 +36,6 @@ MODULE_LICENSE("GPL");MODULE_AUTHOR ("Harald Welte <[email protected]>" );MODULE_DESCRIPTION ("Netfilter NAT protocol helper module for GRE" ); -#if 0 -#define DEBUGP(format, args...) printk(KERN_DEBUG "%s:%s: " format, __FILE__, \ - __FUNCTION__, ## args) -#else -#define DEBUGP(x, args...) -#endif -/* is key in given range between min and max */ static int gre_in_range(const struct nf_conntrack_tuple *tuple,
@@ -83,7 +76,7 @@ gre_unique_tuple(struct nf_conntrack_tuple *tuple, keyptr = &tuple->dst.u.gre.key;if (!(range->flags &IP_NAT_RANGE_PROTO_SPECIFIED )) { -DEBUGP ("%p: NATing GRE PPTP\n" , conntrack); +pr_debug ("%p: NATing GRE PPTP\n" , conntrack); min =1 ; range_size =0xffff ; }else {
@@ -91,7 +84,7 @@ gre_unique_tuple(struct nf_conntrack_tuple *tuple, range_size =ntohs (range->max.gre.key) - min +1 ; } -DEBUGP ("min = %u, range_size = %u\n" , min, range_size); +pr_debug ("min = %u, range_size = %u\n" , min, range_size);for (i =0 ; i < range_size; i++, key++) { *keyptr =htons (min + key % range_size);
@@ -99,7 +92,7 @@ gre_unique_tuple(struct nf_conntrack_tuple *tuple,return 1 ; } -DEBUGP ("%p: no NAT mapping\n" , conntrack); +pr_debug ("%p: no NAT mapping\n" , conntrack);return 0 ; }
@@ -132,11 +125,11 @@ gre_manip_pkt(struct sk_buff **pskb, unsigned int iphdroff,* Try to behave like "nf_nat_proto_unknown" */ break ;case GRE_VERSION_PPTP : -DEBUGP ("call_id -> 0x%04x\n" ,ntohs (tuple->dst.u.gre.key)); +pr_debug ("call_id -> 0x%04x\n" ,ntohs (tuple->dst.u.gre.key)); pgreh->call_id = tuple->dst.u.gre.key;break ;default : -DEBUGP ("can't nat unknown GRE version\n" ); +pr_debug ("can't nat unknown GRE version\n" );return 0 ; }return 1 ;
net/ipv4/netfilter/nf_nat_rule.c +4 -10
@@ -24,12 +24,6 @@#include <net/netfilter/nf_nat_core.h> #include <net/netfilter/nf_nat_rule.h> -#if 0 -#define DEBUGP printk -#else -#define DEBUGP(format, args...) -#endif -#define NAT_VALID_HOOKS ((1<<NF_IP_PRE_ROUTING) | (1<<NF_IP_POST_ROUTING) | (1<<NF_IP_LOCAL_OUT)) static struct
@@ -186,8 +180,8 @@ alloc_null_binding(struct nf_conn *ct, unsigned int hooknum)struct nf_nat_range range = {IP_NAT_RANGE_MAP_IPS , ip, ip, {0 }, {0 } }; -DEBUGP ("Allocating NULL binding for %p (%u.%u.%u.%u)\n" , - ct,NIPQUAD (ip)); +pr_debug ("Allocating NULL binding for %p (%u.%u.%u.%u)\n" , + ct,NIPQUAD (ip));return nf_nat_setup_info (ct, &range, hooknum); }
@@ -205,8 +199,8 @@ alloc_null_binding_confirmed(struct nf_conn *ct, unsigned int hooknum)struct nf_nat_range range = {IP_NAT_RANGE_MAP_IPS , ip, ip, { all }, { all } }; -DEBUGP ("Allocating NULL binding for confirmed %p (%u.%u.%u.%u)\n" , - ct,NIPQUAD (ip)); +pr_debug ("Allocating NULL binding for confirmed %p (%u.%u.%u.%u)\n" , + ct,NIPQUAD (ip));return nf_nat_setup_info (ct, &range, hooknum); }
net/ipv4/netfilter/nf_nat_sip.c +0 -8
@@ -26,12 +26,6 @@ MODULE_AUTHOR("Christian Hentschel <[email protected]>");MODULE_DESCRIPTION ("SIP NAT helper" );MODULE_ALIAS ("ip_nat_sip" ); -#if 0 -#define DEBUGP printk -#else -#define DEBUGP(format, args...) -#endif -struct addr_map {struct {char src[sizeof ("nnn.nnn.nnn.nnn:nnnnn" )];
@@ -257,8 +251,6 @@ static unsigned int ip_nat_sdp(struct sk_buff **pskb,__be32 newip;u_int16_t port; -DEBUGP ("ip_nat_sdp():\n" ); -/* Connection will come from reply */ if (ct->tuplehash[dir].tuple.src.u3.ip == ct->tuplehash[!dir].tuple.dst.u3.ip)
net/ipv4/netfilter/nf_nat_standalone.c +5 -11
@@ -27,12 +27,6 @@#include <net/netfilter/nf_nat_helper.h> #include <linux/netfilter_ipv4/ip_tables.h> -#if 0 -#define DEBUGP printk -#else -#define DEBUGP(format, args...) -#endif -#ifdef CONFIG_XFRM static void nat_decode_session (struct sk_buff *skb,struct flowi *fl) {
@@ -117,7 +111,7 @@ nf_nat_fn(unsigned int hooknum,if (!nat) { nat =nf_ct_ext_add (ct,NF_CT_EXT_NAT ,GFP_ATOMIC );if (nat ==NULL ) { -DEBUGP ("failed to add NAT extension\n" ); +pr_debug ("failed to add NAT extension\n" );return NF_ACCEPT ; } }
@@ -154,9 +148,9 @@ nf_nat_fn(unsigned int hooknum,return ret; } }else -DEBUGP ("Already setup manip %s for ct %p\n" , - maniptype ==IP_NAT_MANIP_SRC ?"SRC" :"DST" , - ct); +pr_debug ("Already setup manip %s for ct %p\n" , + maniptype ==IP_NAT_MANIP_SRC ?"SRC" :"DST" , + ct);break ;default :
@@ -270,7 +264,7 @@ nf_nat_adjust(unsigned int hooknum, ct =nf_ct_get (*pskb, &ctinfo);if (ct &&test_bit (IPS_SEQ_ADJUST_BIT , &ct->status)) { -DEBUGP ("nf_nat_standalone: adjusting sequence number\n" ); +pr_debug ("nf_nat_standalone: adjusting sequence number\n" );if (!nf_nat_seq_adjust (pskb, ct, ctinfo))return NF_DROP ; }
net/ipv6/netfilter/ip6t_LOG.c +3 -9
@@ -32,12 +32,6 @@ struct in_device;#include <net/route.h> #include <linux/netfilter_ipv6/ip6t_LOG.h> -#if 0 -#define DEBUGP printk -#else -#define DEBUGP(format, args...) -#endif -/* Use lock to serialize, so printks don't overlap */ static DEFINE_SPINLOCK (log_lock);
@@ -466,12 +460,12 @@ static bool ip6t_log_checkentry(const char *tablename,const struct ip6t_log_info *loginfo = targinfo;if (loginfo->level >=8 ) { -DEBUGP ("LOG: level %u >= 8\n" , loginfo->level); +pr_debug ("LOG: level %u >= 8\n" , loginfo->level);return false; }if (loginfo->prefix[sizeof (loginfo->prefix)-1 ] !='\0' ) { -DEBUGP ("LOG: prefix term %i\n" , - loginfo->prefix[sizeof (loginfo->prefix)-1 ]); +pr_debug ("LOG: prefix term %i\n" , + loginfo->prefix[sizeof (loginfo->prefix)-1 ]);return false; }return true;
net/ipv6/netfilter/ip6t_REJECT.c +9 -14
@@ -34,12 +34,6 @@ MODULE_AUTHOR("Yasuyuki KOZAKAI <[email protected]>");MODULE_DESCRIPTION ("IP6 tables REJECT target module" );MODULE_LICENSE ("GPL" ); -#if 0 -#define DEBUGP printk -#else -#define DEBUGP(format, args...) -#endif -/* Send RST reply */ static void send_reset (struct sk_buff *oldskb) {
@@ -54,7 +48,7 @@ static void send_reset(struct sk_buff *oldskb)if ((!(ipv6_addr_type (&oip6h->saddr) &IPV6_ADDR_UNICAST )) || (!(ipv6_addr_type (&oip6h->daddr) &IPV6_ADDR_UNICAST ))) { -DEBUGP ("ip6t_REJECT: addr is not unicast.\n" ); +pr_debug ("ip6t_REJECT: addr is not unicast.\n" );return ; }
@@ -62,7 +56,7 @@ static void send_reset(struct sk_buff *oldskb) tcphoff =ipv6_skip_exthdr (oldskb, ((u8 *)(oip6h+1 ) - oldskb->data), &proto);if ((tcphoff <0 ) || (tcphoff > oldskb->len)) { -DEBUGP ("ip6t_REJECT: Can't get TCP header.\n" ); +pr_debug ("ip6t_REJECT: Can't get TCP header.\n" );return ; }
@@ -70,8 +64,9 @@ static void send_reset(struct sk_buff *oldskb)/* IP header checks: fragment, too short. */ if (proto !=IPPROTO_TCP || otcplen <sizeof (struct tcphdr )) { -DEBUGP ("ip6t_REJECT: proto(%d) != IPPROTO_TCP, or too short. otcplen = %d\n" , - proto, otcplen); +pr_debug ("ip6t_REJECT: proto(%d) != IPPROTO_TCP, " +"or too short. otcplen = %d\n" , + proto, otcplen);return ; }
@@ -80,14 +75,14 @@ static void send_reset(struct sk_buff *oldskb)/* No RST for RST. */ if (otcph.rst) { -DEBUGP ("ip6t_REJECT: RST is set\n" ); +pr_debug ("ip6t_REJECT: RST is set\n" );return ; }/* Check checksum. */ if (csum_ipv6_magic (&oip6h->saddr, &oip6h->daddr, otcplen,IPPROTO_TCP ,skb_checksum (oldskb, tcphoff, otcplen,0 ))) { -DEBUGP ("ip6t_REJECT: TCP checksum is invalid\n" ); +pr_debug ("ip6t_REJECT: TCP checksum is invalid\n" );return ; }
@@ -186,7 +181,7 @@ static unsigned int reject6_target(struct sk_buff **pskb, {const struct ip6t_reject_info *reject = targinfo; -DEBUGP (KERN_DEBUG "%s: medium point\n" , __FUNCTION__); +pr_debug ("%s: medium point\n" , __FUNCTION__);/* WARNING: This code causes reentry within ip6tables. This means that the ip6tables jump stack is now crap. We must return an absolute verdict. --RR */
@@ -237,7 +232,7 @@ static bool check(const char *tablename,/* Must specify that it's a TCP packet */ if (e->ipv6.proto !=IPPROTO_TCP || (e->ipv6.invflags &XT_INV_PROTO )) { -DEBUGP ("ip6t_REJECT: TCP_RESET illegal for non-tcp\n" ); +printk ("ip6t_REJECT: TCP_RESET illegal for non-tcp\n" );return false; } }
net/ipv6/netfilter/ip6t_ah.c +21 -26
71 lines not on this page · raw message
net/ipv6/netfilter/ip6t_frag.c +35 -41
100 lines not on this page · raw message
net/ipv6/netfilter/ip6t_hbh.c +19 -26
96 lines not on this page · raw message
net/ipv6/netfilter/ip6t_rt.c +38 -44
152 lines not on this page · raw message
net/ipv6/netfilter/ip6table_mangle.c +0 -6
@@ -21,12 +21,6 @@ MODULE_DESCRIPTION("ip6tables mangle table"); (1 << NF_IP6_LOCAL_OUT) | \ (1 << NF_IP6_POST_ROUTING)) -#if 0 -#define DEBUGP(x, args...) printk(KERN_DEBUG x, ## args) -#else -#define DEBUGP(x, args...) -#endif - static struct { struct ip6t_replace repl;
net/ipv6/netfilter/ip6table_raw.c +0 -6
@@ -8,12 +8,6 @@#define RAW_VALID_HOOKS ((1 << NF_IP6_PRE_ROUTING) | (1 << NF_IP6_LOCAL_OUT)) -#if 0 -#define DEBUGP(x, args...) printk(KERN_DEBUG x, ## args) -#else -#define DEBUGP(x, args...) -#endif - static struct { struct ip6t_replace repl;
net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c +2 -8
@@ -26,12 +26,6 @@#include <net/netfilter/nf_conntrack_l3proto.h> #include <net/netfilter/nf_conntrack_core.h> -#if 0 -#define DEBUGP printk -#else -#define DEBUGP(format, args...) -#endif -static int ipv6_pkt_to_tuple (const struct sk_buff *skb,unsigned int nhoff,struct nf_conntrack_tuple *tuple) {
@@ -136,7 +130,7 @@ ipv6_prepare(struct sk_buff **pskb, unsigned int hooknum, unsigned int *dataoff,* except of IPv6 & ext headers. but it's tracked anyway. - YK */ if ((protoff <0 ) || (protoff > (*pskb)->len)) { -DEBUGP ("ip6_conntrack_core: can't find proto in pkt\n" ); +pr_debug ("ip6_conntrack_core: can't find proto in pkt\n" );NF_CT_STAT_INC_ATOMIC (error);NF_CT_STAT_INC_ATOMIC (invalid);return -NF_ACCEPT ;
@@ -178,7 +172,7 @@ static unsigned int ipv6_confirm(unsigned int hooknum, protoff =nf_ct_ipv6_skip_exthdr (*pskb, extoff, &pnum, (*pskb)->len - extoff);if (protoff > (*pskb)->len || pnum ==NEXTHDR_FRAGMENT ) { -DEBUGP ("proto header not found\n" ); +pr_debug ("proto header not found\n" );return NF_ACCEPT ; }
net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c +10 -14
@@ -27,12 +27,6 @@static unsigned long nf_ct_icmpv6_timeout__read_mostly =30 *HZ ; -#if 0 -#define DEBUGP printk -#else -#define DEBUGP(format, args...) -#endif -static int icmpv6_pkt_to_tuple (const struct sk_buff *skb,unsigned int dataoff,struct nf_conntrack_tuple *tuple)
@@ -125,8 +119,8 @@ static int icmpv6_new(struct nf_conn *conntrack,if (type <0 || type >=sizeof (valid_new) || !valid_new[type]) {/* Can't create a new ICMPv6 `conn' with this. */ -DEBUGP ("icmpv6: can't create new conn with type %u\n" , - type +128 ); +pr_debug ("icmpv6: can't create new conn with type %u\n" , + type +128 );NF_CT_DUMP_TUPLE (&conntrack->tuplehash[0 ].tuple);return 0 ; }
@@ -152,14 +146,15 @@ icmpv6_error_message(struct sk_buff *skb, hp =skb_header_pointer (skb, icmp6off,sizeof (_hdr), &_hdr);if (hp ==NULL ) { -DEBUGP ("icmpv6_error: Can't get ICMPv6 hdr.\n" ); +pr_debug ("icmpv6_error: Can't get ICMPv6 hdr.\n" );return -NF_ACCEPT ; } inip6off = icmp6off +sizeof (_hdr);if (skb_copy_bits (skb, inip6off+offsetof(struct ipv6hdr , nexthdr), &inprotonum,sizeof (inprotonum)) !=0 ) { -DEBUGP ("icmpv6_error: Can't get nexthdr in inner IPv6 header.\n" ); +pr_debug ("icmpv6_error: Can't get nexthdr in inner IPv6 " +"header.\n" );return -NF_ACCEPT ; } inprotoff = nf_ct_ipv6_skip_exthdr(skb,
@@ -169,7 +164,8 @@ icmpv6_error_message(struct sk_buff *skb, - sizeof(struct ipv6hdr));if ((inprotoff > skb->len) || (inprotonum ==NEXTHDR_FRAGMENT )) { -DEBUGP ("icmpv6_error: Can't get protocol header in ICMPv6 payload.\n" ); +pr_debug ("icmpv6_error: Can't get protocol header in ICMPv6 " +"payload.\n" );return -NF_ACCEPT ; }
@@ -179,7 +175,7 @@ icmpv6_error_message(struct sk_buff *skb,/* Are they talking about one of our connections? */ if (!nf_ct_get_tuple (skb, inip6off, inprotoff,PF_INET6 , inprotonum, &origtuple, &nf_conntrack_l3proto_ipv6, inproto)) { -DEBUGP ("icmpv6_error: Can't get tuple\n" ); +pr_debug ("icmpv6_error: Can't get tuple\n" );return -NF_ACCEPT ; }
@@ -187,7 +183,7 @@ icmpv6_error_message(struct sk_buff *skb,been preserved inside the ICMP. */ if (!nf_ct_invert_tuple (&intuple, &origtuple, &nf_conntrack_l3proto_ipv6, inproto)) { -DEBUGP ("icmpv6_error: Can't invert tuple\n" ); +pr_debug ("icmpv6_error: Can't invert tuple\n" );return -NF_ACCEPT ; }
@@ -195,7 +191,7 @@ icmpv6_error_message(struct sk_buff *skb, h =nf_conntrack_find_get (&intuple);if (!h) { -DEBUGP ("icmpv6_error: no match\n" ); +pr_debug ("icmpv6_error: no match\n" );return -NF_ACCEPT ; }else {if (NF_CT_DIRECTION (h) ==IP_CT_DIR_REPLY )
net/ipv6/netfilter/nf_conntrack_reasm.c +23 -29
185 lines not on this page · raw message
net/netfilter/nf_conntrack_core.c +18 -23
133 lines not on this page · raw message
net/netfilter/nf_conntrack_ftp.c +45 -49
217 lines not on this page · raw message
net/netfilter/nf_conntrack_h323_main.c +77 -84
472 lines not on this page · raw message
net/netfilter/nf_conntrack_irc.c +10 -14
@@ -12,6 +12,7 @@#include <linux/moduleparam.h> #include <linux/skbuff.h> #include <linux/in.h> +#include <linux/ip.h> #include <linux/tcp.h> #include <linux/netfilter.h>
@@ -55,13 +56,6 @@ static const char *dccprotos[] = {#define MINMATCHLEN 5 -#if 0 -#define DEBUGP(format, args...) printk(KERN_DEBUG "%s:%s:" format, \ - __FILE__, __FUNCTION__ , ## args) -#else -#define DEBUGP(format, args...) -#endif -/* tries to get the ip_addr and port out of a dcc command * return value: -1 on failure, 0 on success * data pointer to first byte of DCC command data
@@ -99,6 +93,7 @@ static int help(struct sk_buff **pskb, unsigned int protoff, struct nf_conn *ct, enum ip_conntrack_info ctinfo) { unsigned int dataoff; +struct iphdr *iph;struct tcphdr _tcph, *th;char *data, *data_limit, *ib_ptr;int dir =CTINFO2DIR (ctinfo);
@@ -148,9 +143,10 @@ static int help(struct sk_buff **pskb, unsigned int protoff, data +=5 ;/* we have at least (19+MINMATCHLEN)-5 bytes valid data left */ -DEBUGP ("DCC found in master %u.%u.%u.%u:%u %u.%u.%u.%u:%u...\n" , -NIPQUAD (iph->saddr),ntohs (th->source), -NIPQUAD (iph->daddr),ntohs (th->dest)); + iph =ip_hdr (*pskb); +pr_debug ("DCC found in master %u.%u.%u.%u:%u %u.%u.%u.%u:%u\n" , +NIPQUAD (iph->saddr),ntohs (th->source), +NIPQUAD (iph->daddr),ntohs (th->dest));for (i =0 ; i <ARRAY_SIZE (dccprotos); i++) {if (memcmp (data, dccprotos[i],strlen (dccprotos[i]))) {
@@ -158,18 +154,18 @@ static int help(struct sk_buff **pskb, unsigned int protoff,continue ; } data +=strlen (dccprotos[i]); -DEBUGP ("DCC %s detected\n" , dccprotos[i]); +pr_debug ("DCC %s detected\n" , dccprotos[i]);/* we have at least * (19+MINMATCHLEN)-5-dccprotos[i].matchlen bytes valid * data left (== 14/13 bytes) */ if (parse_dcc ((char *)data, data_limit, &dcc_ip, &dcc_port, &addr_beg_p, &addr_end_p)) { -DEBUGP ("unable to parse dcc command\n" ); +pr_debug ("unable to parse dcc command\n" );continue ; } -DEBUGP ("DCC bound ip/port: %u.%u.%u.%u:%u\n" , -HIPQUAD (dcc_ip), dcc_port); +pr_debug ("DCC bound ip/port: %u.%u.%u.%u:%u\n" , +HIPQUAD (dcc_ip), dcc_port);/* dcc_ip can be the internal OR external (NAT'ed) IP */ tuple = &ct->tuplehash[dir].tuple;
net/netfilter/nf_conntrack_l3proto_generic.c +0 -6
@@ -31,12 +31,6 @@#include <net/netfilter/nf_conntrack_core.h> #include <net/netfilter/ipv4/nf_conntrack_ipv4.h> -#if 0 -#define DEBUGP printk -#else -#define DEBUGP(format, args...) -#endif -static int generic_pkt_to_tuple (const struct sk_buff *skb,unsigned int nhoff,struct nf_conntrack_tuple *tuple) {
net/netfilter/nf_conntrack_pptp.c +34 -37
94 lines not on this page · raw message
net/netfilter/nf_conntrack_proto_gre.c +11 -17
Lines of this file are not shown. View the raw message.
net/netfilter/nf_conntrack_proto_sctp.c +30 -62
92 lines not on this page · raw message
net/netfilter/nf_conntrack_proto_tcp.c +59 -70
129 lines not on this page · raw message
net/netfilter/nf_conntrack_standalone.c +0 -6
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.
PATCH 48/50 : nfnetlink_queue: don't unregister handler of other subsystem
In reply to Patrick McHardy[NETFILTER]: nfnetlink_queue: don't unregister handler of other subsystem
The queue handlers registered by ip[6]_queue.ko at initialization should not be unregistered according to requests from userland program using nfnetlink_queue. If we allow that, there is no way to register the handlers of built-in ip[6]_queue again.
---
commit 31358423dfcfd9d0ab6a6b5f168467ef03272562
tree 9d618779c6b1e056e4e79b5beb588c58ea062aa8
parent 6786c212c4a32dccc19cae256b36e80c26640b14
author Yasuyuki Kozakai <[email protected]> Sat, 07 Jul 2007 12:16:10 +0200 committer Patrick McHardy <[email protected]> Sat, 07 Jul 2007 12:16:10 +0200
include/linux/netfilter.h | 3 ++- net/netfilter/nf_queue.c | 7 ++++++- net/netfilter/nfnetlink_queue.c | 4 +--- 3 files changed, 9 insertions(+), 5 deletions(-)
include/linux/netfilter.h +2 -1
@@ -275,7 +275,8 @@ struct nf_queue_handler { };extern int nf_register_queue_handler (int pf,struct nf_queue_handler *qh); -extern int nf_unregister_queue_handler (int pf); +extern int nf_unregister_queue_handler (int pf, +struct nf_queue_handler *qh);extern void nf_unregister_queue_handlers (struct nf_queue_handler *qh); extern void nf_reinject(struct sk_buff *skb, struct nf_info *info,
net/netfilter/nf_queue.c +6 -1
@@ -44,12 +44,17 @@ int nf_register_queue_handler(int pf, struct nf_queue_handler *qh)EXPORT_SYMBOL (nf_register_queue_handler);/* The caller must flush their queue before this */ -int nf_unregister_queue_handler (int pf) +int nf_unregister_queue_handler (int pf,struct nf_queue_handler *qh) {if (pf >=NPROTO )return -EINVAL ;write_lock_bh (&queue_handler_lock); +if (queue_handler[pf] != qh) { +write_unlock_bh (&queue_handler_lock); +return -EINVAL ; + } + queue_handler[pf] =NULL ;write_unlock_bh (&queue_handler_lock);
net/netfilter/nfnetlink_queue.c +1 -3
@@ -913,9 +913,7 @@ nfqnl_recv_config(struct sock *ctnl, struct sk_buff *skb,case NFQNL_CFG_CMD_PF_UNBIND :QDEBUG ("unregistering queue handler for pf=%u\n" ,ntohs (cmd->pf)); -/* This is a bug and a feature. We can unregister -* other handlers(!) */ - ret =nf_unregister_queue_handler (ntohs (cmd->pf)); + ret =nf_unregister_queue_handler (ntohs (cmd->pf), &nfqh);break ;default : ret = -EINVAL ;
PATCH 49/50 : nf_queue: Use RCU and mutex for queue handlers
In reply to Patrick McHardy[NETFILTER]: nf_queue: Use RCU and mutex for queue handlers
Queue handlers are registered/unregistered in only process context.
---
commit 8e3656db48ab327c2d6648c67c05b6b6dd6d2a23
tree b236a710184f1f99712f6a613a28ead8876bd64a
parent 31358423dfcfd9d0ab6a6b5f168467ef03272562
author Yasuyuki Kozakai <[email protected]> Sat, 07 Jul 2007 12:16:11 +0200 committer Patrick McHardy <[email protected]> Sat, 07 Jul 2007 12:16:11 +0200
net/netfilter/nf_queue.c | 52 ++++++++++++++++++++++++++-------------------- 1 files changed, 29 insertions(+), 23 deletions(-)
net/netfilter/nf_queue.c +29 -23
@@ -17,7 +17,7 @@*/ static struct nf_queue_handler *queue_handler[NPROTO ]; -static DEFINE_RWLOCK (queue_handler_lock); +static DEFINE_MUTEX (queue_handler_mutex);/* return EBUSY when somebody else is registered, return EEXIST if the * same handler is registered, return 0 in case of success. */
@@ -28,16 +28,16 @@ int nf_register_queue_handler(int pf, struct nf_queue_handler *qh)if (pf >=NPROTO )return -EINVAL ; -write_lock_bh (&queue_handler_lock); +mutex_lock (&queue_handler_mutex);if (queue_handler[pf] == qh) ret = -EEXIST ;else if (queue_handler[pf]) ret = -EBUSY ;else { - queue_handler[pf] = qh; +rcu_assign_pointer (queue_handler[pf], qh); ret =0 ; } -write_unlock_bh (&queue_handler_lock); +mutex_unlock (&queue_handler_mutex);return ret; }
@@ -49,14 +49,16 @@ int nf_unregister_queue_handler(int pf, struct nf_queue_handler *qh)if (pf >=NPROTO )return -EINVAL ; -write_lock_bh (&queue_handler_lock); +mutex_lock (&queue_handler_mutex);if (queue_handler[pf] != qh) { -write_unlock_bh (&queue_handler_lock); +mutex_unlock (&queue_handler_mutex);return -EINVAL ; } - queue_handler[pf] =NULL ; -write_unlock_bh (&queue_handler_lock); +rcu_assign_pointer (queue_handler[pf],NULL ); +mutex_unlock (&queue_handler_mutex); + +synchronize_rcu ();return 0 ; }
@@ -66,12 +68,14 @@ void nf_unregister_queue_handlers(struct nf_queue_handler *qh) {int pf; -write_lock_bh (&queue_handler_lock); +mutex_lock (&queue_handler_mutex);for (pf =0 ; pf <NPROTO ; pf++) {if (queue_handler[pf] == qh) - queue_handler[pf] =NULL ; +rcu_assign_pointer (queue_handler[pf],NULL ); } -write_unlock_bh (&queue_handler_lock); +mutex_unlock (&queue_handler_mutex); + +synchronize_rcu (); }EXPORT_SYMBOL_GPL (nf_unregister_queue_handlers);
@@ -94,18 +98,21 @@ static int __nf_queue(struct sk_buff *skb,struct net_device *physoutdev =NULL ;#endif struct nf_afinfo *afinfo; +struct nf_queue_handler *qh;/* QUEUE == DROP if noone is waiting, to be safe. */ -read_lock (&queue_handler_lock); -if (!queue_handler[pf]) { -read_unlock (&queue_handler_lock); +rcu_read_lock (); + + qh =rcu_dereference (queue_handler[pf]); +if (!qh) { +rcu_read_unlock ();kfree_skb (skb);return 1 ; } afinfo =nf_get_afinfo (pf);if (!afinfo) { -read_unlock (&queue_handler_lock); +rcu_read_unlock ();kfree_skb (skb);return 1 ; }
@@ -115,7 +122,7 @@ static int __nf_queue(struct sk_buff *skb,if (net_ratelimit ())printk (KERN_ERR "OOM queueing packet %p\n" , skb); -read_unlock (&queue_handler_lock); +rcu_read_unlock ();kfree_skb (skb);return 1 ; }
@@ -125,7 +132,7 @@ static int __nf_queue(struct sk_buff *skb,/* If it's going away, ignore hook. */ if (!try_module_get (info->elem->owner)) { -read_unlock (&queue_handler_lock); +rcu_read_unlock ();kfree (info);return 0 ; }
@@ -143,10 +150,9 @@ static int __nf_queue(struct sk_buff *skb, }#endif afinfo->saveroute (skb, info); - status = queue_handler[pf]->outfn (skb, info, queuenum, - queue_handler[pf]->data); + status = qh->outfn (skb, info, queuenum, qh->data); -read_unlock (&queue_handler_lock); +rcu_read_unlock ();if (status <0 ) {/* James M doesn't say fuck enough. */
@@ -313,13 +319,13 @@ static int seq_show(struct seq_file *s, void *v)loff_t *pos = v;struct nf_queue_handler *qh; -read_lock_bh (&queue_handler_lock); - qh = queue_handler[*pos]; +rcu_read_lock (); + qh =rcu_dereference (queue_handler[*pos]);if (!qh) ret =seq_printf (s,"%2lld NONE\n" , *pos);else ret =seq_printf (s,"%2lld %s\n" , *pos, qh->name); -read_unlock_bh (&queue_handler_lock); +rcu_read_unlock ();return ret; }
PATCH 50/50 : x_tables: add more detail to error message about match/target mask mismatch
In reply to Patrick McHardy[NETFILTER]: x_tables: add more detail to error message about match/target mask mismatch
---
commit 89ada54fbb7711869e3731018de4d5447ea6aee4
tree 7152b6d8ae6664b4a99b014a015aae28e99f2694
parent 8e3656db48ab327c2d6648c67c05b6b6dd6d2a23
author Balazs Scheidler <[email protected]> Sat, 07 Jul 2007 12:16:12 +0200 committer Patrick McHardy <[email protected]> Sat, 07 Jul 2007 12:16:12 +0200
net/netfilter/x_tables.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-)
net/netfilter/x_tables.c +5 -4
@@ -320,8 +320,8 @@ int xt_check_match(const struct xt_match *match, unsigned short family,return -EINVAL ; }if (match->hooks && (hook_mask & ~match->hooks) !=0 ) { -printk ("%s_tables: %s match: bad hook_mask %u\n" , - xt_prefix[family], match->name, hook_mask); +printk ("%s_tables: %s match: bad hook_mask %u/%u\n" , + xt_prefix[family], match->name, hook_mask, match->hooks);return -EINVAL ; }if (match->proto && (match->proto != proto || inv_proto)) {
@@ -410,8 +410,9 @@ int xt_check_target(const struct xt_target *target, unsigned short family,return -EINVAL ; }if (target->hooks && (hook_mask & ~target->hooks) !=0 ) { -printk ("%s_tables: %s target: bad hook_mask %u\n" , - xt_prefix[family], target->name, hook_mask); +printk ("%s_tables: %s target: bad hook_mask %u/%u\n" , + xt_prefix[family], target->name, hook_mask, + target->hooks);return -EINVAL ; }if (target->proto && (target->proto != proto || inv_proto)) {
David Miller
maintainerFrom: Patrick McHardy <[email protected]>
Date: Sat, 7 Jul 2007 14:23:00 +0200 (MEST)
Quoted 20 lines
following is a large netfilter update for 2.6.23, featuring
- rework of the conntrack allocator by Yasuyuki. We're now using dynamically sized extension areas for things like helper data, expectations, NAT. This fixes a number of problems resulting from the old allocator scheme, most importantly we don't need to search the helper and expectation lists twice anymore.
- conversion of the conntrack and NAT hash tables to hlists
- patches to reduce the ability to mask tuples in expectations and helpers, which allows to keep them in a hash table. This fixes an easy DoS against conntrack and should also improve performance.
- improvement of conntrack eviction under pressure
- new
xt_TRACEtarget that allows to trace packets through the netfilter hooks (unfortunately needs 1 bit in the skb)
Quoted 8 lines
- new
xt_u32match, which is the iptables equivalent tocls_u32- some cleanup work by Jan Engelhardt to use bools where possible
- lots of minor cleanups: conversion from self-made debugging macros to
pr_debug,__read_mostlyannotations, ...Please apply, thanks.
Excellent work, all applied and pushed out.
Thanks!