Skip to content

Commit 28b78ec

Browse files
Florian Westphalummakynes
authored andcommitted
netfilter: bridge: add support for pppoe filtering
This makes 'bridge-nf-filter-pppoe-tagged' sysctl work for bridged traffic. Looking at the original commit it doesn't appear this ever worked: static unsigned int br_nf_post_routing(unsigned int hook, struct sk_buff **pskb, [..] if (skb->protocol == htons(ETH_P_8021Q)) { skb_pull(skb, VLAN_HLEN); skb->network_header += VLAN_HLEN; + } else if (skb->protocol == htons(ETH_P_PPP_SES)) { + skb_pull(skb, PPPOE_SES_HLEN); + skb->network_header += PPPOE_SES_HLEN; } [..] NF_HOOK(... POST_ROUTING, ...) ... but the adjusted offsets are never restored. The alternative would be to rip this code out for good, but otoh we'd have to keep this anyway for the vlan handling (which works because vlan tag info is in the skb, not the packet payload). Reported-and-tested-by: Amish Chana <[email protected]> Fixes: 516299d ("[NETFILTER]: bridge-nf: filter bridged IPv4/IPv6 encapsulated in pppoe traffic") Signed-off-by: Florian Westphal <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent f87b946 commit 28b78ec

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

net/bridge/br_netfilter_hooks.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,9 @@ static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buff
743743
if (nf_bridge->frag_max_size && nf_bridge->frag_max_size < mtu)
744744
mtu = nf_bridge->frag_max_size;
745745

746+
nf_bridge_update_protocol(skb);
747+
nf_bridge_push_encap_header(skb);
748+
746749
if (skb_is_gso(skb) || skb->len + mtu_reserved <= mtu) {
747750
nf_bridge_info_free(skb);
748751
return br_dev_queue_push_xmit(net, sk, skb);
@@ -760,8 +763,6 @@ static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buff
760763

761764
IPCB(skb)->frag_max_size = nf_bridge->frag_max_size;
762765

763-
nf_bridge_update_protocol(skb);
764-
765766
data = this_cpu_ptr(&brnf_frag_data_storage);
766767

767768
if (skb_vlan_tag_present(skb)) {
@@ -789,8 +790,6 @@ static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buff
789790

790791
IP6CB(skb)->frag_max_size = nf_bridge->frag_max_size;
791792

792-
nf_bridge_update_protocol(skb);
793-
794793
data = this_cpu_ptr(&brnf_frag_data_storage);
795794
data->encap_size = nf_bridge_encap_header_len(skb);
796795
data->size = ETH_HLEN + data->encap_size;

0 commit comments

Comments
 (0)