Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 34736
b: refs/heads/master
c: e21e0b5
h: refs/heads/master
v: v3
  • Loading branch information
Ville Nuorvala authored and David S. Miller committed Sep 22, 2006
1 parent 951fd96 commit 8099ac2
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4c5de695cf7f71c85ad8cfff509f6475b8bd4d27
refs/heads/master: e21e0b5f19ac7835a244c2016f7ed726f971b3e9
45 changes: 45 additions & 0 deletions trunk/net/ipv6/ip6_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,46 @@ static int ip6_call_ra_chain(struct sk_buff *skb, int sel)
return 0;
}

static int ip6_forward_proxy_check(struct sk_buff *skb)
{
struct ipv6hdr *hdr = skb->nh.ipv6h;
u8 nexthdr = hdr->nexthdr;
int offset;

if (ipv6_ext_hdr(nexthdr)) {
offset = ipv6_skip_exthdr(skb, sizeof(*hdr), &nexthdr);
if (offset < 0)
return 0;
} else
offset = sizeof(struct ipv6hdr);

if (nexthdr == IPPROTO_ICMPV6) {
struct icmp6hdr *icmp6;

if (!pskb_may_pull(skb, skb->nh.raw + offset + 1 - skb->data))
return 0;

icmp6 = (struct icmp6hdr *)(skb->nh.raw + offset);

switch (icmp6->icmp6_type) {
case NDISC_ROUTER_SOLICITATION:
case NDISC_ROUTER_ADVERTISEMENT:
case NDISC_NEIGHBOUR_SOLICITATION:
case NDISC_NEIGHBOUR_ADVERTISEMENT:
case NDISC_REDIRECT:
/* For reaction involving unicast neighbor discovery
* message destined to the proxied address, pass it to
* input function.
*/
return 1;
default:
break;
}
}

return 0;
}

static inline int ip6_forward_finish(struct sk_buff *skb)
{
return dst_output(skb);
Expand Down Expand Up @@ -362,6 +402,11 @@ int ip6_forward(struct sk_buff *skb)
return -ETIMEDOUT;
}

if (pneigh_lookup(&nd_tbl, &hdr->daddr, skb->dev, 0)) {
if (ip6_forward_proxy_check(skb))
return ip6_input(skb);
}

if (!xfrm6_route_forward(skb)) {
IP6_INC_STATS(IPSTATS_MIB_INDISCARDS);
goto drop;
Expand Down

0 comments on commit 8099ac2

Please sign in to comment.