Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f894cbf8 authored by David S. Miller's avatar David S. Miller
Browse files

net: Add optional SKB arg to dst_ops->neigh_lookup().



Causes the handler to use the daddr in the ipv4/ipv6 header when
the route gateway is unspecified (local subnet).

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5110effe
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -420,7 +420,13 @@ static inline int dst_neigh_output(struct dst_entry *dst, struct neighbour *n,

static inline struct neighbour *dst_neigh_lookup(const struct dst_entry *dst, const void *daddr)
{
	return dst->ops->neigh_lookup(dst, daddr);
	return dst->ops->neigh_lookup(dst, NULL, daddr);
}

static inline struct neighbour *dst_neigh_lookup_skb(const struct dst_entry *dst,
						     struct sk_buff *skb)
{
	return dst->ops->neigh_lookup(dst, skb, NULL);
}

static inline void dst_link_failure(struct sk_buff *skb)
+3 −1
Original line number Diff line number Diff line
@@ -26,7 +26,9 @@ struct dst_ops {
	void			(*link_failure)(struct sk_buff *);
	void			(*update_pmtu)(struct dst_entry *dst, u32 mtu);
	int			(*local_out)(struct sk_buff *skb);
	struct neighbour *	(*neigh_lookup)(const struct dst_entry *dst, const void *daddr);
	struct neighbour *	(*neigh_lookup)(const struct dst_entry *dst,
						struct sk_buff *skb,
						const void *daddr);

	struct kmem_cache	*kmem_cachep;

+3 −1
Original line number Diff line number Diff line
@@ -120,7 +120,9 @@ static u32 *fake_cow_metrics(struct dst_entry *dst, unsigned long old)
	return NULL;
}

static struct neighbour *fake_neigh_lookup(const struct dst_entry *dst, const void *daddr)
static struct neighbour *fake_neigh_lookup(const struct dst_entry *dst,
					   struct sk_buff *skb,
					   const void *daddr)
{
	return NULL;
}
+6 −2
Original line number Diff line number Diff line
@@ -117,7 +117,9 @@ static void dn_dst_destroy(struct dst_entry *);
static struct dst_entry *dn_dst_negative_advice(struct dst_entry *);
static void dn_dst_link_failure(struct sk_buff *);
static void dn_dst_update_pmtu(struct dst_entry *dst, u32 mtu);
static struct neighbour *dn_dst_neigh_lookup(const struct dst_entry *dst, const void *daddr);
static struct neighbour *dn_dst_neigh_lookup(const struct dst_entry *dst,
					     struct sk_buff *skb,
					     const void *daddr);
static int dn_route_input(struct sk_buff *);
static void dn_run_flush(unsigned long dummy);

@@ -828,7 +830,9 @@ static unsigned int dn_dst_mtu(const struct dst_entry *dst)
	return mtu ? : dst->dev->mtu;
}

static struct neighbour *dn_dst_neigh_lookup(const struct dst_entry *dst, const void *daddr)
static struct neighbour *dn_dst_neigh_lookup(const struct dst_entry *dst,
					     struct sk_buff *skb,
					     const void *daddr)
{
	return __neigh_lookup_errno(&dn_neigh_table, daddr, dst->dev);
}
+10 −4
Original line number Diff line number Diff line
@@ -188,7 +188,9 @@ static u32 *ipv4_cow_metrics(struct dst_entry *dst, unsigned long old)
	return p;
}

static struct neighbour *ipv4_neigh_lookup(const struct dst_entry *dst, const void *daddr);
static struct neighbour *ipv4_neigh_lookup(const struct dst_entry *dst,
					   struct sk_buff *skb,
					   const void *daddr);

static struct dst_ops ipv4_dst_ops = {
	.family =		AF_INET,
@@ -1088,7 +1090,9 @@ static int slow_chain_length(const struct rtable *head)
	return length >> FRACT_BITS;
}

static struct neighbour *ipv4_neigh_lookup(const struct dst_entry *dst, const void *daddr)
static struct neighbour *ipv4_neigh_lookup(const struct dst_entry *dst,
					   struct sk_buff *skb,
					   const void *daddr)
{
	struct net_device *dev = dst->dev;
	const __be32 *pkey = daddr;
@@ -1098,6 +1102,8 @@ static struct neighbour *ipv4_neigh_lookup(const struct dst_entry *dst, const vo
	rt = (const struct rtable *) dst;
	if (rt->rt_gateway)
		pkey = (const __be32 *) &rt->rt_gateway;
	else if (skb)
		pkey = &ip_hdr(skb)->daddr;

	n = __ipv4_neigh_lookup(dev, *(__force u32 *)pkey);
	if (n)
@@ -1107,7 +1113,7 @@ static struct neighbour *ipv4_neigh_lookup(const struct dst_entry *dst, const vo

static int rt_bind_neighbour(struct rtable *rt)
{
	struct neighbour *n = ipv4_neigh_lookup(&rt->dst, &rt->rt_gateway);
	struct neighbour *n = ipv4_neigh_lookup(&rt->dst, NULL, &rt->rt_gateway);
	if (IS_ERR(n))
		return PTR_ERR(n);
	dst_set_neighbour(&rt->dst, n);
@@ -1388,7 +1394,7 @@ static void check_peer_redir(struct dst_entry *dst, struct inet_peer *peer)

	rt->rt_gateway = peer->redirect_learned.a4;

	n = ipv4_neigh_lookup(&rt->dst, &rt->rt_gateway);
	n = ipv4_neigh_lookup(&rt->dst, NULL, &rt->rt_gateway);
	if (IS_ERR(n)) {
		rt->rt_gateway = orig_gw;
		return;
Loading