Commit aca071c1c1c07bcc0b100b7c58e59790d6be6a69
Committed by
David S. Miller
1 parent
3d04ebb6ab
netfilter: xt_hashlimit: use proto_ports_offset() to support AH message
Signed-off-by: Changli Gao <xiaosuo@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 1 changed file with 5 additions and 10 deletions Side-by-side Diff
net/netfilter/xt_hashlimit.c
... | ... | @@ -448,6 +448,7 @@ |
448 | 448 | { |
449 | 449 | __be16 _ports[2], *ports; |
450 | 450 | u8 nexthdr; |
451 | + int poff; | |
451 | 452 | |
452 | 453 | memset(dst, 0, sizeof(*dst)); |
453 | 454 | |
454 | 455 | |
455 | 456 | |
... | ... | @@ -492,19 +493,13 @@ |
492 | 493 | return 0; |
493 | 494 | } |
494 | 495 | |
495 | - switch (nexthdr) { | |
496 | - case IPPROTO_TCP: | |
497 | - case IPPROTO_UDP: | |
498 | - case IPPROTO_UDPLITE: | |
499 | - case IPPROTO_SCTP: | |
500 | - case IPPROTO_DCCP: | |
501 | - ports = skb_header_pointer(skb, protoff, sizeof(_ports), | |
496 | + poff = proto_ports_offset(nexthdr); | |
497 | + if (poff >= 0) { | |
498 | + ports = skb_header_pointer(skb, protoff + poff, sizeof(_ports), | |
502 | 499 | &_ports); |
503 | - break; | |
504 | - default: | |
500 | + } else { | |
505 | 501 | _ports[0] = _ports[1] = 0; |
506 | 502 | ports = _ports; |
507 | - break; | |
508 | 503 | } |
509 | 504 | if (!ports) |
510 | 505 | return -1; |