diff options
| author | Patrick McHardy <kaber@trash.net> | 2006-12-13 19:54:25 -0500 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2006-12-13 19:54:25 -0500 |
| commit | 2bf540b73ed5b304e84bb4d4c390d49d1cfa0ef8 (patch) | |
| tree | 7bd4a6e6c8720906226d56cbce162f85287661aa | |
| parent | 8bce65b95ac167693ae2d706b5341409dca0062d (diff) | |
[NETFILTER]: bridge-netfilter: remove deferred hooks
Remove the deferred hooks and all related code as scheduled in
feature-removal-schedule.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
| -rw-r--r-- | Documentation/feature-removal-schedule.txt | 16 | ||||
| -rw-r--r-- | include/linux/netfilter_bridge.h | 1 | ||||
| -rw-r--r-- | include/linux/netfilter_ipv4.h | 2 | ||||
| -rw-r--r-- | include/linux/netfilter_ipv6.h | 2 | ||||
| -rw-r--r-- | net/bridge/br_netfilter.c | 188 | ||||
| -rw-r--r-- | net/netfilter/xt_physdev.c | 12 |
6 files changed, 20 insertions, 201 deletions
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index 040f437c42..30f3c8c9c1 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt | |||
| @@ -207,22 +207,6 @@ Who: Thomas Gleixner <tglx@linutronix.de> | |||
| 207 | 207 | ||
| 208 | --------------------------- | 208 | --------------------------- |
| 209 | 209 | ||
| 210 | What: Bridge netfilter deferred IPv4/IPv6 output hook calling | ||
| 211 | When: January 2007 | ||
| 212 | Why: The deferred output hooks are a layering violation causing unusual | ||
| 213 | and broken behaviour on bridge devices. Examples of things they | ||
| 214 | break include QoS classifation using the MARK or CLASSIFY targets, | ||
| 215 | the IPsec policy match and connection tracking with VLANs on a | ||
| 216 | bridge. Their only use is to enable bridge output port filtering | ||
| 217 | within iptables with the physdev match, which can also be done by | ||
| 218 | combining iptables and ebtables using netfilter marks. Until it | ||
| 219 | will get removed the hook deferral is disabled by default and is | ||
| 220 | only enabled when needed. | ||
| 221 | |||
| 222 | Who: Patrick McHardy <kaber@trash.net> | ||
| 223 | |||
| 224 | --------------------------- | ||
| 225 | |||
| 226 | What: PHYSDEVPATH, PHYSDEVBUS, PHYSDEVDRIVER in the uevent environment | 210 | What: PHYSDEVPATH, PHYSDEVBUS, PHYSDEVDRIVER in the uevent environment |
| 227 | When: October 2008 | 211 | When: October 2008 |
| 228 | Why: The stacking of class devices makes these values misleading and | 212 | Why: The stacking of class devices makes these values misleading and |
diff --git a/include/linux/netfilter_bridge.h b/include/linux/netfilter_bridge.h index 6c4613f8ad..55689f39f7 100644 --- a/include/linux/netfilter_bridge.h +++ b/include/linux/netfilter_bridge.h | |||
| @@ -68,7 +68,6 @@ struct bridge_skb_cb { | |||
| 68 | } daddr; | 68 | } daddr; |
| 69 | }; | 69 | }; |
| 70 | 70 | ||
| 71 | extern int brnf_deferred_hooks; | ||
| 72 | #else | 71 | #else |
| 73 | #define nf_bridge_maybe_copy_header(skb) (0) | 72 | #define nf_bridge_maybe_copy_header(skb) (0) |
| 74 | #define nf_bridge_pad(skb) (0) | 73 | #define nf_bridge_pad(skb) (0) |
diff --git a/include/linux/netfilter_ipv4.h b/include/linux/netfilter_ipv4.h index 5821eb5a0a..ceae87a4c8 100644 --- a/include/linux/netfilter_ipv4.h +++ b/include/linux/netfilter_ipv4.h | |||
| @@ -57,10 +57,8 @@ enum nf_ip_hook_priorities { | |||
| 57 | NF_IP_PRI_RAW = -300, | 57 | NF_IP_PRI_RAW = -300, |
| 58 | NF_IP_PRI_SELINUX_FIRST = -225, | 58 | NF_IP_PRI_SELINUX_FIRST = -225, |
| 59 | NF_IP_PRI_CONNTRACK = -200, | 59 | NF_IP_PRI_CONNTRACK = -200, |
| 60 | NF_IP_PRI_BRIDGE_SABOTAGE_FORWARD = -175, | ||
| 61 | NF_IP_PRI_MANGLE = -150, | 60 | NF_IP_PRI_MANGLE = -150, |
| 62 | NF_IP_PRI_NAT_DST = -100, | 61 | NF_IP_PRI_NAT_DST = -100, |
| 63 | NF_IP_PRI_BRIDGE_SABOTAGE_LOCAL_OUT = -50, | ||
| 64 | NF_IP_PRI_FILTER = 0, | 62 | NF_IP_PRI_FILTER = 0, |
| 65 | NF_IP_PRI_NAT_SRC = 100, | 63 | NF_IP_PRI_NAT_SRC = 100, |
| 66 | NF_IP_PRI_SELINUX_LAST = 225, | 64 | NF_IP_PRI_SELINUX_LAST = 225, |
diff --git a/include/linux/netfilter_ipv6.h b/include/linux/netfilter_ipv6.h index ab81a6dc94..66ca8e3100 100644 --- a/include/linux/netfilter_ipv6.h +++ b/include/linux/netfilter_ipv6.h | |||
| @@ -62,10 +62,8 @@ enum nf_ip6_hook_priorities { | |||
| 62 | NF_IP6_PRI_CONNTRACK_DEFRAG = -400, | 62 | NF_IP6_PRI_CONNTRACK_DEFRAG = -400, |
| 63 | NF_IP6_PRI_SELINUX_FIRST = -225, | 63 | NF_IP6_PRI_SELINUX_FIRST = -225, |
| 64 | NF_IP6_PRI_CONNTRACK = -200, | 64 | NF_IP6_PRI_CONNTRACK = -200, |
| 65 | NF_IP6_PRI_BRIDGE_SABOTAGE_FORWARD = -175, | ||
| 66 | NF_IP6_PRI_MANGLE = -150, | 65 | NF_IP6_PRI_MANGLE = -150, |
| 67 | NF_IP6_PRI_NAT_DST = -100, | 66 | NF_IP6_PRI_NAT_DST = -100, |
| 68 | NF_IP6_PRI_BRIDGE_SABOTAGE_LOCAL_OUT = -50, | ||
| 69 | NF_IP6_PRI_FILTER = 0, | 67 | NF_IP6_PRI_FILTER = 0, |
| 70 | NF_IP6_PRI_NAT_SRC = 100, | 68 | NF_IP6_PRI_NAT_SRC = 100, |
| 71 | NF_IP6_PRI_SELINUX_LAST = 225, | 69 | NF_IP6_PRI_SELINUX_LAST = 225, |
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c index bd221ad52e..ea3337ad0e 100644 --- a/net/bridge/br_netfilter.c +++ b/net/bridge/br_netfilter.c | |||
| @@ -61,9 +61,6 @@ static int brnf_filter_vlan_tagged __read_mostly = 1; | |||
| 61 | #define brnf_filter_vlan_tagged 1 | 61 | #define brnf_filter_vlan_tagged 1 |
| 62 | #endif | 62 | #endif |
| 63 | 63 | ||
| 64 | int brnf_deferred_hooks; | ||
| 65 | EXPORT_SYMBOL_GPL(brnf_deferred_hooks); | ||
| 66 | |||
| 67 | static __be16 inline vlan_proto(const struct sk_buff *skb) | 64 | static __be16 inline vlan_proto(const struct sk_buff *skb) |
| 68 | { | 65 | { |
| 69 | return vlan_eth_hdr(skb)->h_vlan_encapsulated_proto; | 66 | return vlan_eth_hdr(skb)->h_vlan_encapsulated_proto; |
| @@ -685,110 +682,50 @@ static unsigned int br_nf_forward_arp(unsigned int hook, struct sk_buff **pskb, | |||
| 685 | return NF_STOLEN; | 682 | return NF_STOLEN; |
| 686 | } | 683 | } |
| 687 | 684 | ||
| 688 | /* PF_BRIDGE/LOCAL_OUT ***********************************************/ | 685 | /* PF_BRIDGE/LOCAL_OUT *********************************************** |
| 689 | static int br_nf_local_out_finish(struct sk_buff *skb) | 686 | * |
| 690 | { | 687 | * This function sees both locally originated IP packets and forwarded |
| 691 | if (skb->protocol == htons(ETH_P_8021Q)) { | ||
| 692 | skb_push(skb, VLAN_HLEN); | ||
| 693 | skb->nh.raw -= VLAN_HLEN; | ||
| 694 | } | ||
| 695 | |||
| 696 | NF_HOOK_THRESH(PF_BRIDGE, NF_BR_LOCAL_OUT, skb, NULL, skb->dev, | ||
| 697 | br_forward_finish, NF_BR_PRI_FIRST + 1); | ||
| 698 | |||
| 699 | return 0; | ||
| 700 | } | ||
| 701 | |||
| 702 | /* This function sees both locally originated IP packets and forwarded | ||
| 703 | * IP packets (in both cases the destination device is a bridge | 688 | * IP packets (in both cases the destination device is a bridge |
| 704 | * device). It also sees bridged-and-DNAT'ed packets. | 689 | * device). It also sees bridged-and-DNAT'ed packets. |
| 705 | * To be able to filter on the physical bridge devices (with the physdev | ||
| 706 | * module), we steal packets destined to a bridge device away from the | ||
| 707 | * PF_INET/FORWARD and PF_INET/OUTPUT hook functions, and give them back later, | ||
| 708 | * when we have determined the real output device. This is done in here. | ||
| 709 | * | 690 | * |
| 710 | * If (nf_bridge->mask & BRNF_BRIDGED_DNAT) then the packet is bridged | 691 | * If (nf_bridge->mask & BRNF_BRIDGED_DNAT) then the packet is bridged |
| 711 | * and we fake the PF_BRIDGE/FORWARD hook. The function br_nf_forward() | 692 | * and we fake the PF_BRIDGE/FORWARD hook. The function br_nf_forward() |
| 712 | * will then fake the PF_INET/FORWARD hook. br_nf_local_out() has priority | 693 | * will then fake the PF_INET/FORWARD hook. br_nf_local_out() has priority |
| 713 | * NF_BR_PRI_FIRST, so no relevant PF_BRIDGE/INPUT functions have been nor | 694 | * NF_BR_PRI_FIRST, so no relevant PF_BRIDGE/INPUT functions have been nor |
| 714 | * will be executed. | 695 | * will be executed. |
| 715 | * Otherwise, if nf_bridge->physindev is NULL, the bridge-nf code never touched | 696 | */ |
| 716 | * this packet before, and so the packet was locally originated. We fake | ||
| 717 | * the PF_INET/LOCAL_OUT hook. | ||
| 718 | * Finally, if nf_bridge->physindev isn't NULL, then the packet was IP routed, | ||
| 719 | * so we fake the PF_INET/FORWARD hook. ip_sabotage_out() makes sure | ||
| 720 | * even routed packets that didn't arrive on a bridge interface have their | ||
| 721 | * nf_bridge->physindev set. */ | ||
| 722 | static unsigned int br_nf_local_out(unsigned int hook, struct sk_buff **pskb, | 697 | static unsigned int br_nf_local_out(unsigned int hook, struct sk_buff **pskb, |
| 723 | const struct net_device *in, | 698 | const struct net_device *in, |
| 724 | const struct net_device *out, | 699 | const struct net_device *out, |
| 725 | int (*okfn)(struct sk_buff *)) | 700 | int (*okfn)(struct sk_buff *)) |
| 726 | { | 701 | { |
| 727 | struct net_device *realindev, *realoutdev; | 702 | struct net_device *realindev; |
| 728 | struct sk_buff *skb = *pskb; | 703 | struct sk_buff *skb = *pskb; |
| 729 | struct nf_bridge_info *nf_bridge; | 704 | struct nf_bridge_info *nf_bridge; |
| 730 | int pf; | ||
| 731 | 705 | ||
| 732 | if (!skb->nf_bridge) | 706 | if (!skb->nf_bridge) |
| 733 | return NF_ACCEPT; | 707 | return NF_ACCEPT; |
| 734 | 708 | ||
| 735 | if (skb->protocol == htons(ETH_P_IP) || IS_VLAN_IP(skb)) | ||
| 736 | pf = PF_INET; | ||
| 737 | else | ||
| 738 | pf = PF_INET6; | ||
| 739 | |||
| 740 | nf_bridge = skb->nf_bridge; | 709 | nf_bridge = skb->nf_bridge; |
| 741 | nf_bridge->physoutdev = skb->dev; | 710 | if (!(nf_bridge->mask & BRNF_BRIDGED_DNAT)) |
| 742 | realindev = nf_bridge->physindev; | 711 | return NF_ACCEPT; |
| 743 | 712 | ||
| 744 | /* Bridged, take PF_BRIDGE/FORWARD. | 713 | /* Bridged, take PF_BRIDGE/FORWARD. |
| 745 | * (see big note in front of br_nf_pre_routing_finish) */ | 714 | * (see big note in front of br_nf_pre_routing_finish) */ |
| 746 | if (nf_bridge->mask & BRNF_BRIDGED_DNAT) { | 715 | nf_bridge->physoutdev = skb->dev; |
| 747 | if (nf_bridge->mask & BRNF_PKT_TYPE) { | 716 | realindev = nf_bridge->physindev; |
| 748 | skb->pkt_type = PACKET_OTHERHOST; | ||
| 749 | nf_bridge->mask ^= BRNF_PKT_TYPE; | ||
| 750 | } | ||
| 751 | if (skb->protocol == htons(ETH_P_8021Q)) { | ||
| 752 | skb_push(skb, VLAN_HLEN); | ||
| 753 | skb->nh.raw -= VLAN_HLEN; | ||
| 754 | } | ||
| 755 | 717 | ||
| 756 | NF_HOOK(PF_BRIDGE, NF_BR_FORWARD, skb, realindev, | 718 | if (nf_bridge->mask & BRNF_PKT_TYPE) { |
| 757 | skb->dev, br_forward_finish); | 719 | skb->pkt_type = PACKET_OTHERHOST; |
| 758 | goto out; | 720 | nf_bridge->mask ^= BRNF_PKT_TYPE; |
| 759 | } | 721 | } |
| 760 | realoutdev = bridge_parent(skb->dev); | ||
| 761 | if (!realoutdev) | ||
| 762 | return NF_DROP; | ||
| 763 | |||
| 764 | #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) | ||
| 765 | /* iptables should match -o br0.x */ | ||
| 766 | if (nf_bridge->netoutdev) | ||
| 767 | realoutdev = nf_bridge->netoutdev; | ||
| 768 | #endif | ||
| 769 | if (skb->protocol == htons(ETH_P_8021Q)) { | 722 | if (skb->protocol == htons(ETH_P_8021Q)) { |
| 770 | skb_pull(skb, VLAN_HLEN); | 723 | |
