From c4c753d456e59ebbef673394c65231c8b85fb292 Mon Sep 17 00:00:00 2001 From: Bart De Schuymer Date: Tue, 17 Sep 2002 21:39:55 +0000 Subject: *** empty log message *** --- br-nf-bds/linux/include/linux/skbuff.h | 2 -- br-nf-bds/linux/net/bridge/br.c | 22 +++------------------- br-nf-bds/linux/net/bridge/br_forward.c | 2 +- br-nf-bds/linux/net/bridge/br_input.c | 13 +++---------- br-nf-bds/linux/net/core/netfilter.c | 6 ------ br-nf-bds/linux/net/core/skbuff.c | 8 +------- br-nf-bds/linux/net/ipv4/ip_output.c | 8 +++----- br-nf-bds/linux/net/ipv4/netfilter/ip_tables.c | 24 ++---------------------- 8 files changed, 13 insertions(+), 72 deletions(-) (limited to 'br-nf-bds') diff --git a/br-nf-bds/linux/include/linux/skbuff.h b/br-nf-bds/linux/include/linux/skbuff.h index 5a6ce25..257b586 100644 --- a/br-nf-bds/linux/include/linux/skbuff.h +++ b/br-nf-bds/linux/include/linux/skbuff.h @@ -135,10 +135,8 @@ struct sk_buff { struct sock *sk; /* Socket we are owned by */ struct timeval stamp; /* Time we arrived */ struct net_device *dev; /* Device we arrived on/are leaving by */ -#ifdef CONFIG_BRIDGE_NF struct net_device *physindev; /* Physical device we arrived on */ struct net_device *physoutdev; /* Physical device we will leave by */ -#endif /* Transport layer header */ union diff --git a/br-nf-bds/linux/net/bridge/br.c b/br-nf-bds/linux/net/bridge/br.c index 2109a5d..8fbde85 100644 --- a/br-nf-bds/linux/net/bridge/br.c +++ b/br-nf-bds/linux/net/bridge/br.c @@ -5,7 +5,7 @@ * Authors: * Lennert Buytenhek * - * $Id: br.c,v 1.2 2002/08/24 08:44:40 bdschuym Exp $ + * $Id: br.c,v 1.3 2002/09/17 21:42:06 bdschuym Exp $ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -28,13 +28,7 @@ #include "../atm/lec.h" #endif -#if defined(CONFIG_BRIDGE_EBT_BROUTE) || \ - defined(CONFIG_BRIDGE_EBT_BROUTE_MODULE) -unsigned int (*broute_decision) (unsigned int hook, struct sk_buff **pskb, - const struct net_device *in, - const struct net_device *out, - int (*okfn)(struct sk_buff *)) = NULL; -#endif +int (*br_should_route_hook) (struct sk_buff **pskb) = NULL; void br_dec_use_count() { @@ -50,11 +44,8 @@ static int __init br_init(void) { printk(KERN_INFO "NET4: Ethernet Bridge 008 for NET4.0\n"); -#ifdef CONFIG_BRIDGE_NF if (br_netfilter_init()) return 1; -#endif - br_handle_frame_hook = br_handle_frame; br_ioctl_hook = br_ioctl_deviceless_stub; #if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE) @@ -78,9 +69,7 @@ static void __br_clear_ioctl_hook(void) static void __exit br_deinit(void) { -#ifdef CONFIG_BRIDGE_NF br_netfilter_fini(); -#endif unregister_netdevice_notifier(&br_device_notifier); br_call_ioctl_atomic(__br_clear_ioctl_hook); net_call_rx_atomic(__br_clear_frame_hook); @@ -90,12 +79,7 @@ static void __exit br_deinit(void) #endif } -#if defined(CONFIG_BRIDGE_EBT_BROUTE) || \ - defined(CONFIG_BRIDGE_EBT_BROUTE_MODULE) -EXPORT_SYMBOL(broute_decision); -#else -EXPORT_NO_SYMBOLS; -#endif +EXPORT_SYMBOL(br_should_route_hook); module_init(br_init) module_exit(br_deinit) diff --git a/br-nf-bds/linux/net/bridge/br_forward.c b/br-nf-bds/linux/net/bridge/br_forward.c index 0780d63..6f38e7e 100644 --- a/br-nf-bds/linux/net/bridge/br_forward.c +++ b/br-nf-bds/linux/net/bridge/br_forward.c @@ -5,7 +5,7 @@ * Authors: * Lennert Buytenhek * - * $Id: br_forward.c,v 1.3 2002/09/10 17:38:52 bdschuym Exp $ + * $Id: br_forward.c,v 1.4 2002/09/17 21:44:16 bdschuym Exp $ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License diff --git a/br-nf-bds/linux/net/bridge/br_input.c b/br-nf-bds/linux/net/bridge/br_input.c index 5a506de..6d9f5c0 100644 --- a/br-nf-bds/linux/net/bridge/br_input.c +++ b/br-nf-bds/linux/net/bridge/br_input.c @@ -5,7 +5,7 @@ * Authors: * Lennert Buytenhek * - * $Id: br_input.c,v 1.3 2002/09/10 17:35:52 bdschuym Exp $ + * $Id: br_input.c,v 1.4 2002/09/17 21:44:59 bdschuym Exp $ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -19,10 +19,6 @@ #include #include #include "br_private.h" -#if defined(CONFIG_BRIDGE_EBT_BROUTE) || \ - defined(CONFIG_BRIDGE_EBT_BROUTE_MODULE) -#include -#endif unsigned char bridge_ula[6] = { 0x01, 0x80, 0xc2, 0x00, 0x00, 0x00 }; @@ -153,12 +149,9 @@ int br_handle_frame(struct sk_buff *skb) goto handle_special_frame; if (p->state == BR_STATE_FORWARDING) { -#if defined(CONFIG_BRIDGE_EBT_BROUTE) || \ - defined(CONFIG_BRIDGE_EBT_BROUTE_MODULE) - if (broute_decision && broute_decision(NF_BR_BROUTING, &skb, - skb->dev, NULL, NULL) == NF_DROP) + if (br_should_route_hook && br_should_route_hook(&skb)) return -1; -#endif + NF_HOOK(PF_BRIDGE, NF_BR_PRE_ROUTING, skb, skb->dev, NULL, br_handle_frame_finish); read_unlock(&br->lock); diff --git a/br-nf-bds/linux/net/core/netfilter.c b/br-nf-bds/linux/net/core/netfilter.c index 1a1cb88..198dad6 100644 --- a/br-nf-bds/linux/net/core/netfilter.c +++ b/br-nf-bds/linux/net/core/netfilter.c @@ -418,10 +418,8 @@ static void nf_queue(struct sk_buff *skb, { int status; struct nf_info *info; -#ifdef CONFIG_BRIDGE_NF struct net_device *physindev; struct net_device *physoutdev; -#endif if (!queue_handler[pf].outfn) { kfree_skb(skb); @@ -444,20 +442,16 @@ static void nf_queue(struct sk_buff *skb, if (indev) dev_hold(indev); if (outdev) dev_hold(outdev); -#ifdef CONFIG_BRIDGE_NF if ((physindev = skb->physindev)) dev_hold(physindev); if ((physoutdev = skb->physoutdev)) dev_hold(physoutdev); -#endif status = queue_handler[pf].outfn(skb, info, queue_handler[pf].data); if (status < 0) { /* James M doesn't say fuck enough. */ if (indev) dev_put(indev); if (outdev) dev_put(outdev); -#ifdef CONFIG_BRIDGE_NF if (physindev) dev_put(physindev); if (physoutdev) dev_put(physoutdev); -#endif kfree(info); kfree_skb(skb); return; diff --git a/br-nf-bds/linux/net/core/skbuff.c b/br-nf-bds/linux/net/core/skbuff.c index 0e9e70b..d77feab 100644 --- a/br-nf-bds/linux/net/core/skbuff.c +++ b/br-nf-bds/linux/net/core/skbuff.c @@ -4,7 +4,7 @@ * Authors: Alan Cox * Florian La Roche * - * Version: $Id: skbuff.c,v 1.3 2002/08/24 16:24:13 bdschuym Exp $ + * Version: $Id: skbuff.c,v 1.4 2002/09/17 21:49:57 bdschuym Exp $ * * Fixes: * Alan Cox : Fixed the worst of the load balancer bugs. @@ -231,10 +231,8 @@ static inline void skb_headerinit(void *p, kmem_cache_t *cache, skb->sk = NULL; skb->stamp.tv_sec=0; /* No idea about time */ skb->dev = NULL; -#ifdef CONFIG_BRIDGE_NF skb->physindev = NULL; skb->physoutdev = NULL; -#endif skb->dst = NULL; memset(skb->cb, 0, sizeof(skb->cb)); skb->pkt_type = PACKET_HOST; /* Default type */ @@ -366,10 +364,8 @@ struct sk_buff *skb_clone(struct sk_buff *skb, int gfp_mask) n->sk = NULL; C(stamp); C(dev); -#ifdef CONFIG_BRIDGE_NF C(physindev); C(physoutdev); -#endif C(h); C(nh); C(mac); @@ -425,10 +421,8 @@ static void copy_skb_header(struct sk_buff *new, const struct sk_buff *old) new->list=NULL; new->sk=NULL; new->dev=old->dev; -#ifdef CONFIG_BRIDGE_NF new->physindev=old->physindev; new->physoutdev=old->physoutdev; -#endif new->priority=old->priority; new->protocol=old->protocol; new->dst=dst_clone(old->dst); diff --git a/br-nf-bds/linux/net/ipv4/ip_output.c b/br-nf-bds/linux/net/ipv4/ip_output.c index 0429d8f..ad1f552 100644 --- a/br-nf-bds/linux/net/ipv4/ip_output.c +++ b/br-nf-bds/linux/net/ipv4/ip_output.c @@ -5,7 +5,7 @@ * * The Internet Protocol (IP) output module. * - * Version: $Id: ip_output.c,v 1.3 2002/08/24 16:25:17 bdschuym Exp $ + * Version: $Id: ip_output.c,v 1.4 2002/09/17 21:51:08 bdschuym Exp $ * * Authors: Ross Biro, * Fred N. van Kempen, @@ -830,10 +830,8 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*)) skb_set_owner_w(skb2, skb->sk); skb2->dst = dst_clone(skb->dst); skb2->dev = skb->dev; -#ifdef CONFIG_BRIDGE_NF skb2->physindev = skb->physindev; skb2->physoutdev = skb->physoutdev; -#endif /* * Copy the packet header into the new buffer. @@ -897,9 +895,9 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*)) iph->tot_len = htons(len + hlen); ip_send_check(iph); -#ifdef CONFIG_BRIDGE_NF + + // for bridge-netfilter memcpy(skb2->data - 16, skb->data - 16, 16); -#endif err = output(skb2); if (err) diff --git a/br-nf-bds/linux/net/ipv4/netfilter/ip_tables.c b/br-nf-bds/linux/net/ipv4/netfilter/ip_tables.c index 53afb3b..6c203eb 100644 --- a/br-nf-bds/linux/net/ipv4/netfilter/ip_tables.c +++ b/br-nf-bds/linux/net/ipv4/netfilter/ip_tables.c @@ -122,19 +122,14 @@ static LIST_HEAD(ipt_tables); static inline int ip_packet_match(const struct iphdr *ip, const char *indev, -#ifdef CONFIG_BRIDGE_NF const char *physindev, -#endif const char *outdev, -#ifdef CONFIG_BRIDGE_NF const char *physoutdev, -#endif const struct ipt_ip *ipinfo, int isfrag) { size_t i; - unsigned long ret; - unsigned long ret2 = 1; + unsigned long ret, ret2; #define FWINV(bool,invflg) ((bool) ^ !!(ipinfo->invflags & invflg)) @@ -164,13 +159,11 @@ ip_packet_match(const struct iphdr *ip, & ((const unsigned long *)ipinfo->iniface_mask)[i]; } -#ifdef CONFIG_BRIDGE_NF for (i = 0, ret2 = 0; i < IFNAMSIZ/sizeof(unsigned long); i++) { ret2 |= (((const unsigned long *)physindev)[i] ^ ((const unsigned long *)ipinfo->iniface)[i]) & ((const unsigned long *)ipinfo->iniface_mask)[i]; } -#endif if (FWINV(ret != 0 && ret2 != 0, IPT_INV_VIA_IN)) { dprintf("VIA in mismatch (%s vs %s).%s\n", @@ -185,13 +178,11 @@ ip_packet_match(const struct iphdr *ip, & ((const unsigned long *)ipinfo->outiface_mask)[i]; } -#ifdef CONFIG_BRIDGE_NF for (i = 0, ret2 = 0; i < IFNAMSIZ/sizeof(unsigned long); i++) { ret2 |= (((const unsigned long *)physoutdev)[i] ^ ((const unsigned long *)ipinfo->outiface)[i]) & ((const unsigned long *)ipinfo->outiface_mask)[i]; } -#endif if (FWINV(ret != 0 && ret2 != 0, IPT_INV_VIA_OUT)) { dprintf("VIA out mismatch (%s vs %s).%s\n", @@ -292,9 +283,7 @@ ipt_do_table(struct sk_buff **pskb, /* Initializing verdict to NF_DROP keeps gcc happy. */ unsigned int verdict = NF_DROP; const char *indev, *outdev; -#ifdef CONFIG_BRIDGE_NF const char *physindev, *physoutdev; -#endif void *table_base; struct ipt_entry *e, *back; @@ -304,10 +293,8 @@ ipt_do_table(struct sk_buff **pskb, datalen = (*pskb)->len - ip->ihl * 4; indev = in ? in->name : nulldevname; outdev = out ? out->name : nulldevname; -#ifdef CONFIG_BRIDGE_NF physindev = (*pskb)->physindev ? (*pskb)->physindev->name : nulldevname; physoutdev = (*pskb)->physoutdev ? (*pskb)->physoutdev->name : nulldevname; -#endif /* We handle fragments by dealing with the first fragment as * if it was a normal packet. All other fragments are treated @@ -344,14 +331,7 @@ ipt_do_table(struct sk_buff **pskb, IP_NF_ASSERT(e); IP_NF_ASSERT(back); (*pskb)->nfcache |= e->nfcache; - if (ip_packet_match(ip, indev, -#ifdef CONFIG_BRIDGE_NF - physindev, -#endif - outdev, -#ifdef CONFIG_BRIDGE_NF - physoutdev, -#endif + if (ip_packet_match(ip, indev, physindev, outdev, physoutdev, &e->ip, offset)) { struct ipt_entry_target *t; -- cgit v1.2.3