* [PATCH] netfilter: ipv6: let ipv6_find_hdr() fail when offset can't be found
@ 2011-09-29 23:52 JP Abgrall
0 siblings, 0 replies; only message in thread
From: JP Abgrall @ 2011-09-29 23:52 UTC (permalink / raw)
To: netfilter-devel; +Cc: JP Abgrall
There are some cases where the caller wants the last target and only
the offset. But it turns out that there are cases with fragments where
the final nexthdr is something like IPPROTO_UDP.
This would lead the caller to believe the offset was valid.
Before the "fragoff" days, any fragment would cause a negative return value.
So return -ENOENT when fragoff is 0 and the offset can't be set.
Change-Id: Ib474e8a4267dd2b300feca325811330329684a88
Signed-off-by: JP Abgrall <jpa@google.com>
---
:100644 100644 94874b0... eda6703... M net/ipv6/netfilter/ip6_tables.c
net/ipv6/netfilter/ip6_tables.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c
index 94874b0..eda6703 100644
--- a/net/ipv6/netfilter/ip6_tables.c
+++ b/net/ipv6/netfilter/ip6_tables.c
@@ -2300,7 +2300,7 @@ static void __exit ip6_tables_fini(void)
* Note that non-1st fragment is special case that "the protocol number
* of last header" is "next header" field in Fragment header. In this case,
* *offset is meaningless and fragment offset is stored in *fragoff if fragoff
- * isn't NULL.
+ * isn't NULL. And if fragoff is NULL, function returns -1.
*
*/
int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,
@@ -2344,6 +2344,8 @@ int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,
hp->nexthdr == NEXTHDR_NONE)) {
if (fragoff)
*fragoff = _frag_off;
+ else
+ return -ENOENT;
return hp->nexthdr;
}
return -ENOENT;
--
1.7.3.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2011-09-29 23:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-29 23:52 [PATCH] netfilter: ipv6: let ipv6_find_hdr() fail when offset can't be found JP Abgrall
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).