Commit 13696531 authored by David S. Miller's avatar David S. Miller

Merge branch 'ipv6-fix-neighbour-resolution-with-raw-socket'

Nicolas Dichtel says:

====================
ipv6: fix neighbour resolution with raw socket

The first patch prepares the fix, it constify rt6_nexthop().
The detail of the bug is explained in the second patch.

v1 -> v2:
 - fix compilation warnings
 - split the initial patch
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 22e72b5e 2c6b55f4
...@@ -350,8 +350,8 @@ static int vrf_finish_output6(struct net *net, struct sock *sk, ...@@ -350,8 +350,8 @@ static int vrf_finish_output6(struct net *net, struct sock *sk,
{ {
struct dst_entry *dst = skb_dst(skb); struct dst_entry *dst = skb_dst(skb);
struct net_device *dev = dst->dev; struct net_device *dev = dst->dev;
const struct in6_addr *nexthop;
struct neighbour *neigh; struct neighbour *neigh;
struct in6_addr *nexthop;
int ret; int ret;
nf_reset(skb); nf_reset(skb);
......
...@@ -262,8 +262,8 @@ static inline bool ip6_sk_ignore_df(const struct sock *sk) ...@@ -262,8 +262,8 @@ static inline bool ip6_sk_ignore_df(const struct sock *sk)
inet6_sk(sk)->pmtudisc == IPV6_PMTUDISC_OMIT; inet6_sk(sk)->pmtudisc == IPV6_PMTUDISC_OMIT;
} }
static inline struct in6_addr *rt6_nexthop(struct rt6_info *rt, static inline const struct in6_addr *rt6_nexthop(const struct rt6_info *rt,
struct in6_addr *daddr) const struct in6_addr *daddr)
{ {
if (rt->rt6i_flags & RTF_GATEWAY) if (rt->rt6i_flags & RTF_GATEWAY)
return &rt->rt6i_gateway; return &rt->rt6i_gateway;
......
...@@ -160,10 +160,10 @@ static inline struct lowpan_peer *peer_lookup_dst(struct lowpan_btle_dev *dev, ...@@ -160,10 +160,10 @@ static inline struct lowpan_peer *peer_lookup_dst(struct lowpan_btle_dev *dev,
struct in6_addr *daddr, struct in6_addr *daddr,
struct sk_buff *skb) struct sk_buff *skb)
{ {
struct lowpan_peer *peer;
struct in6_addr *nexthop;
struct rt6_info *rt = (struct rt6_info *)skb_dst(skb); struct rt6_info *rt = (struct rt6_info *)skb_dst(skb);
int count = atomic_read(&dev->peer_count); int count = atomic_read(&dev->peer_count);
const struct in6_addr *nexthop;
struct lowpan_peer *peer;
BT_DBG("peers %d addr %pI6c rt %p", count, daddr, rt); BT_DBG("peers %d addr %pI6c rt %p", count, daddr, rt);
......
...@@ -59,8 +59,8 @@ static int ip6_finish_output2(struct net *net, struct sock *sk, struct sk_buff * ...@@ -59,8 +59,8 @@ static int ip6_finish_output2(struct net *net, struct sock *sk, struct sk_buff *
{ {
struct dst_entry *dst = skb_dst(skb); struct dst_entry *dst = skb_dst(skb);
struct net_device *dev = dst->dev; struct net_device *dev = dst->dev;
const struct in6_addr *nexthop;
struct neighbour *neigh; struct neighbour *neigh;
struct in6_addr *nexthop;
int ret; int ret;
if (ipv6_addr_is_multicast(&ipv6_hdr(skb)->daddr)) { if (ipv6_addr_is_multicast(&ipv6_hdr(skb)->daddr)) {
......
...@@ -218,7 +218,8 @@ static struct neighbour *ip6_dst_neigh_lookup(const struct dst_entry *dst, ...@@ -218,7 +218,8 @@ static struct neighbour *ip6_dst_neigh_lookup(const struct dst_entry *dst,
{ {
const struct rt6_info *rt = container_of(dst, struct rt6_info, dst); const struct rt6_info *rt = container_of(dst, struct rt6_info, dst);
return ip6_neigh_lookup(&rt->rt6i_gateway, dst->dev, skb, daddr); return ip6_neigh_lookup(rt6_nexthop(rt, &in6addr_any),
dst->dev, skb, daddr);
} }
static void ip6_confirm_neigh(const struct dst_entry *dst, const void *daddr) static void ip6_confirm_neigh(const struct dst_entry *dst, const void *daddr)
......
...@@ -439,9 +439,9 @@ nf_flow_offload_ipv6_hook(void *priv, struct sk_buff *skb, ...@@ -439,9 +439,9 @@ nf_flow_offload_ipv6_hook(void *priv, struct sk_buff *skb,
struct nf_flowtable *flow_table = priv; struct nf_flowtable *flow_table = priv;
struct flow_offload_tuple tuple = {}; struct flow_offload_tuple tuple = {};
enum flow_offload_tuple_dir dir; enum flow_offload_tuple_dir dir;
const struct in6_addr *nexthop;
struct flow_offload *flow; struct flow_offload *flow;
struct net_device *outdev; struct net_device *outdev;
struct in6_addr *nexthop;
struct ipv6hdr *ip6h; struct ipv6hdr *ip6h;
struct rt6_info *rt; struct rt6_info *rt;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment