Commit 7677e868 authored by Herbert Xu's avatar Herbert Xu Committed by Pablo Neira Ayuso

bridge: Do not compile options in br_parse_ip_options

Commit 462fb2af

	bridge : Sanitize skb before it enters the IP stack

broke when IP options are actually used because it mangles the
skb as if it entered the IP stack which is wrong because the
bridge is supposed to operate below the IP stack.

Since nobody has actually requested for parsing of IP options
this patch fixes it by simply reverting to the previous approach
of ignoring all IP options, i.e., zeroing the IPCB.

If and when somebody who uses IP options and actually needs them
to be parsed by the bridge complains then we can revisit this.
Reported-by: default avatarDavid Newall <davidn@davidnewall.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Tested-by: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent c123bb71
...@@ -192,7 +192,6 @@ static inline void nf_bridge_save_header(struct sk_buff *skb) ...@@ -192,7 +192,6 @@ static inline void nf_bridge_save_header(struct sk_buff *skb)
static int br_parse_ip_options(struct sk_buff *skb) static int br_parse_ip_options(struct sk_buff *skb)
{ {
struct ip_options *opt;
const struct iphdr *iph; const struct iphdr *iph;
struct net_device *dev = skb->dev; struct net_device *dev = skb->dev;
u32 len; u32 len;
...@@ -201,7 +200,6 @@ static int br_parse_ip_options(struct sk_buff *skb) ...@@ -201,7 +200,6 @@ static int br_parse_ip_options(struct sk_buff *skb)
goto inhdr_error; goto inhdr_error;
iph = ip_hdr(skb); iph = ip_hdr(skb);
opt = &(IPCB(skb)->opt);
/* Basic sanity checks */ /* Basic sanity checks */
if (iph->ihl < 5 || iph->version != 4) if (iph->ihl < 5 || iph->version != 4)
...@@ -227,23 +225,11 @@ static int br_parse_ip_options(struct sk_buff *skb) ...@@ -227,23 +225,11 @@ static int br_parse_ip_options(struct sk_buff *skb)
} }
memset(IPCB(skb), 0, sizeof(struct inet_skb_parm)); memset(IPCB(skb), 0, sizeof(struct inet_skb_parm));
if (iph->ihl == 5) /* We should really parse IP options here but until
return 0; * somebody who actually uses IP options complains to
* us we'll just silently ignore the options because
opt->optlen = iph->ihl*4 - sizeof(struct iphdr); * we're lazy!
if (ip_options_compile(dev_net(dev), opt, skb)) */
goto inhdr_error;
/* Check correct handling of SRR option */
if (unlikely(opt->srr)) {
struct in_device *in_dev = __in_dev_get_rcu(dev);
if (in_dev && !IN_DEV_SOURCE_ROUTE(in_dev))
goto drop;
if (ip_options_rcv_srr(skb))
goto drop;
}
return 0; return 0;
inhdr_error: inhdr_error:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment