diff options
author | Andrew McDonald <andrew@mcdonald.org.uk> | 2005-08-09 22:44:42 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2005-08-29 18:37:06 -0400 |
commit | 0bd1b59b15e4057101c89d4db15a3683c0d897f7 (patch) | |
tree | 1912652fdf55f1bcc703ae9a3dcb93036dcfca67 /net/ipv6/raw.c | |
parent | 7af4cc3fa158ff1dda6e7451c7e6afa6b0bb85cb (diff) |
[IPV6]: Check interface bindings on IPv6 raw socket reception
Take account of whether a socket is bound to a particular device when
selecting an IPv6 raw socket to receive a packet. Also perform this
check when receiving IPv6 packets with router alert options.
Signed-off-by: Andrew McDonald <andrew@mcdonald.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/raw.c')
-rw-r--r-- | net/ipv6/raw.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index 1d4d75b34d32..9db0de81f074 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c | |||
@@ -81,7 +81,8 @@ static void raw_v6_unhash(struct sock *sk) | |||
81 | 81 | ||
82 | /* Grumble... icmp and ip_input want to get at this... */ | 82 | /* Grumble... icmp and ip_input want to get at this... */ |
83 | struct sock *__raw_v6_lookup(struct sock *sk, unsigned short num, | 83 | struct sock *__raw_v6_lookup(struct sock *sk, unsigned short num, |
84 | struct in6_addr *loc_addr, struct in6_addr *rmt_addr) | 84 | struct in6_addr *loc_addr, struct in6_addr *rmt_addr, |
85 | int dif) | ||
85 | { | 86 | { |
86 | struct hlist_node *node; | 87 | struct hlist_node *node; |
87 | int is_multicast = ipv6_addr_is_multicast(loc_addr); | 88 | int is_multicast = ipv6_addr_is_multicast(loc_addr); |
@@ -94,6 +95,9 @@ struct sock *__raw_v6_lookup(struct sock *sk, unsigned short num, | |||
94 | !ipv6_addr_equal(&np->daddr, rmt_addr)) | 95 | !ipv6_addr_equal(&np->daddr, rmt_addr)) |
95 | continue; | 96 | continue; |
96 | 97 | ||
98 | if (sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif) | ||
99 | continue; | ||
100 | |||
97 | if (!ipv6_addr_any(&np->rcv_saddr)) { | 101 | if (!ipv6_addr_any(&np->rcv_saddr)) { |
98 | if (ipv6_addr_equal(&np->rcv_saddr, loc_addr)) | 102 | if (ipv6_addr_equal(&np->rcv_saddr, loc_addr)) |
99 | goto found; | 103 | goto found; |
@@ -160,7 +164,7 @@ void ipv6_raw_deliver(struct sk_buff *skb, int nexthdr) | |||
160 | if (sk == NULL) | 164 | if (sk == NULL) |
161 | goto out; | 165 | goto out; |
162 | 166 | ||
163 | sk = __raw_v6_lookup(sk, nexthdr, daddr, saddr); | 167 | sk = __raw_v6_lookup(sk, nexthdr, daddr, saddr, skb->dev->ifindex); |
164 | 168 | ||
165 | while (sk) { | 169 | while (sk) { |
166 | if (nexthdr != IPPROTO_ICMPV6 || !icmpv6_filter(sk, skb)) { | 170 | if (nexthdr != IPPROTO_ICMPV6 || !icmpv6_filter(sk, skb)) { |
@@ -170,7 +174,8 @@ void ipv6_raw_deliver(struct sk_buff *skb, int nexthdr) | |||
170 | if (clone) | 174 | if (clone) |
171 | rawv6_rcv(sk, clone); | 175 | rawv6_rcv(sk, clone); |
172 | } | 176 | } |
173 | sk = __raw_v6_lookup(sk_next(sk), nexthdr, daddr, saddr); | 177 | sk = __raw_v6_lookup(sk_next(sk), nexthdr, daddr, saddr, |
178 | skb->dev->ifindex); | ||
174 | } | 179 | } |
175 | out: | 180 | out: |
176 | read_unlock(&raw_v6_lock); | 181 | read_unlock(&raw_v6_lock); |