* [PATCH 4/4] netfilter: bridge: rename br_parse_ip_options and delete unneeded code
@ 2015-03-18 21:56 Bernhard Thaler
2015-03-23 12:43 ` Florian Westphal
0 siblings, 1 reply; 4+ messages in thread
From: Bernhard Thaler @ 2015-03-18 21:56 UTC (permalink / raw)
To: pablo, kadlec; +Cc: netfilter-devel, fw, Bernhard Thaler
br_parse_ip_options() does not parse any IP options, it validates IP
packets as a whole and the function name is misleading.
Rename it and delete unneeded assignment of iph variable.
Signed-off-by: Bernhard Thaler <bernhard.thaler@wvnet.at>
---
net/bridge/br_netfilter.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
index 0e129fb..2d73565 100644
--- a/net/bridge/br_netfilter.c
+++ b/net/bridge/br_netfilter.c
@@ -198,7 +198,7 @@ static inline void nf_bridge_save_header(struct sk_buff *skb)
* expected format
*/
-static int br_parse_ip_options(struct sk_buff *skb)
+static int br_validate_ipv4(struct sk_buff *skb)
{
const struct iphdr *iph;
struct net_device *dev = skb->dev;
@@ -300,7 +300,7 @@ bad:
return -1;
}
-/* Equivalent to br_parse_ip_options for IPv6 */
+/* Equivalent to br_validate_ipv4 for IPv6 */
static int br_validate_ipv6(struct sk_buff *skb)
{
const struct ipv6hdr *hdr;
@@ -718,7 +718,7 @@ static unsigned int br_nf_pre_routing(const struct nf_hook_ops *ops,
nf_bridge_pull_encap_header_rcsum(skb);
- if (br_parse_ip_options(skb))
+ if (br_validate_ipv4(skb))
return NF_DROP;
nf_bridge_put(skb->nf_bridge);
@@ -819,7 +819,7 @@ static unsigned int br_nf_forward_ip(const struct nf_hook_ops *ops,
nf_bridge->mask |= BRNF_PKT_TYPE;
}
- if (pf == NFPROTO_IPV4 && br_parse_ip_options(skb))
+ if (pf == NFPROTO_IPV4 && br_validate_ipv4(skb))
return NF_DROP;
/* The physdev module checks on this */
@@ -914,7 +914,7 @@ static int br_nf_dev_queue_xmit(struct sk_buff *skb)
* boundaries by preserving frag_list rather than refragmenting.
*/
if (skb->protocol == htons(ETH_P_IP)) {
- if (br_parse_ip_options(skb))
+ if (br_validate_ipv4(skb))
/* Drop invalid packet */
return NF_DROP;
IPCB(skb)->frag_max_size = BR_INPUT_SKB_CB(skb)->frag_max_size;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 4/4] netfilter: bridge: rename br_parse_ip_options and delete unneeded code
2015-03-18 21:56 [PATCH 4/4] netfilter: bridge: rename br_parse_ip_options and delete unneeded code Bernhard Thaler
@ 2015-03-23 12:43 ` Florian Westphal
2015-03-23 22:29 ` [PATCHv2 " Bernhard Thaler
0 siblings, 1 reply; 4+ messages in thread
From: Florian Westphal @ 2015-03-23 12:43 UTC (permalink / raw)
To: Bernhard Thaler; +Cc: pablo, kadlec, netfilter-devel, fw
Bernhard Thaler <bernhard.thaler@wvnet.at> wrote:
> br_parse_ip_options() does not parse any IP options, it validates IP
> packets as a whole and the function name is misleading.
Right.
> Rename it and delete unneeded assignment of iph variable.
?
I don't see any change in this regard.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCHv2 4/4] netfilter: bridge: rename br_parse_ip_options and delete unneeded code
2015-03-23 12:43 ` Florian Westphal
@ 2015-03-23 22:29 ` Bernhard Thaler
2015-03-24 12:14 ` Florian Westphal
0 siblings, 1 reply; 4+ messages in thread
From: Bernhard Thaler @ 2015-03-23 22:29 UTC (permalink / raw)
To: pablo, kadlec; +Cc: netfilter-devel, fw, Bernhard Thaler
br_parse_ip_options() does not parse any IP options, it validates IP
packets as a whole and the function name is misleading.
Rename br_parse_ip_options() and delete unneeded double assignment
of iph variable.
Signed-off-by: Bernhard Thaler <bernhard.thaler@wvnet.at>
---
v2
* first patch did not contain statement removing double iph variable
assignment
net/bridge/br_netfilter.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
index 0e129fb..fbc206a 100644
--- a/net/bridge/br_netfilter.c
+++ b/net/bridge/br_netfilter.c
@@ -198,7 +198,7 @@ static inline void nf_bridge_save_header(struct sk_buff *skb)
* expected format
*/
-static int br_parse_ip_options(struct sk_buff *skb)
+static int br_validate_ipv4(struct sk_buff *skb)
{
const struct iphdr *iph;
struct net_device *dev = skb->dev;
@@ -216,7 +216,6 @@ static int br_parse_ip_options(struct sk_buff *skb)
if (!pskb_may_pull(skb, iph->ihl*4))
goto inhdr_error;
- iph = ip_hdr(skb);
if (unlikely(ip_fast_csum((u8 *)iph, iph->ihl)))
goto inhdr_error;
@@ -300,7 +299,7 @@ bad:
return -1;
}
-/* Equivalent to br_parse_ip_options for IPv6 */
+/* Equivalent to br_validate_ipv4 for IPv6 */
static int br_validate_ipv6(struct sk_buff *skb)
{
const struct ipv6hdr *hdr;
@@ -718,7 +717,7 @@ static unsigned int br_nf_pre_routing(const struct nf_hook_ops *ops,
nf_bridge_pull_encap_header_rcsum(skb);
- if (br_parse_ip_options(skb))
+ if (br_validate_ipv4(skb))
return NF_DROP;
nf_bridge_put(skb->nf_bridge);
@@ -819,7 +818,7 @@ static unsigned int br_nf_forward_ip(const struct nf_hook_ops *ops,
nf_bridge->mask |= BRNF_PKT_TYPE;
}
- if (pf == NFPROTO_IPV4 && br_parse_ip_options(skb))
+ if (pf == NFPROTO_IPV4 && br_validate_ipv4(skb))
return NF_DROP;
/* The physdev module checks on this */
@@ -914,7 +913,7 @@ static int br_nf_dev_queue_xmit(struct sk_buff *skb)
* boundaries by preserving frag_list rather than refragmenting.
*/
if (skb->protocol == htons(ETH_P_IP)) {
- if (br_parse_ip_options(skb))
+ if (br_validate_ipv4(skb))
/* Drop invalid packet */
return NF_DROP;
IPCB(skb)->frag_max_size = BR_INPUT_SKB_CB(skb)->frag_max_size;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCHv2 4/4] netfilter: bridge: rename br_parse_ip_options and delete unneeded code
2015-03-23 22:29 ` [PATCHv2 " Bernhard Thaler
@ 2015-03-24 12:14 ` Florian Westphal
0 siblings, 0 replies; 4+ messages in thread
From: Florian Westphal @ 2015-03-24 12:14 UTC (permalink / raw)
To: Bernhard Thaler; +Cc: pablo, kadlec, netfilter-devel, fw
Bernhard Thaler <bernhard.thaler@wvnet.at> wrote:
> br_parse_ip_options() does not parse any IP options, it validates IP
> packets as a whole and the function name is misleading.
>
> Rename br_parse_ip_options() and delete unneeded double assignment
> of iph variable.
>
> Signed-off-by: Bernhard Thaler <bernhard.thaler@wvnet.at>
> ---
> @@ -216,7 +216,6 @@ static int br_parse_ip_options(struct sk_buff *skb)
> if (!pskb_may_pull(skb, iph->ihl*4))
> goto inhdr_error;
>
> - iph = ip_hdr(skb);
pskb_may_pull() might invalidate the network header, we have to refetch
iph because of this.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-03-24 12:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-18 21:56 [PATCH 4/4] netfilter: bridge: rename br_parse_ip_options and delete unneeded code Bernhard Thaler
2015-03-23 12:43 ` Florian Westphal
2015-03-23 22:29 ` [PATCHv2 " Bernhard Thaler
2015-03-24 12:14 ` Florian Westphal
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.