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

Commit 191cd582 authored by Brian Haley's avatar Brian Haley Committed by David S. Miller
Browse files

netns: Add network namespace argument to rt6_fill_node() and ipv6_dev_get_saddr()



ipv6_dev_get_saddr() blindly de-references dst_dev to get the network
namespace, but some callers might pass NULL.  Change callers to pass a
namespace pointer instead.

Signed-off-by: default avatarBrian Haley <brian.haley@hp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0eb8b1fe
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -80,7 +80,8 @@ extern struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net,
						 struct net_device *dev,
						 int strict);

extern int			ipv6_dev_get_saddr(struct net_device *dev, 
extern int			ipv6_dev_get_saddr(struct net *net,
					       struct net_device *dev,
					       const struct in6_addr *daddr,
					       unsigned int srcprefs,
					       struct in6_addr *saddr);
+1 −0
Original line number Diff line number Diff line
@@ -107,6 +107,7 @@ struct rt6_rtnl_dump_arg
{
	struct sk_buff *skb;
	struct netlink_callback *cb;
	struct net *net;
};

extern int rt6_dump_route(struct rt6_info *rt, void *p_arg);
+1 −2
Original line number Diff line number Diff line
@@ -1106,13 +1106,12 @@ static int ipv6_get_saddr_eval(struct net *net,
	return ret;
}

int ipv6_dev_get_saddr(struct net_device *dst_dev,
int ipv6_dev_get_saddr(struct net *net, struct net_device *dst_dev,
		       const struct in6_addr *daddr, unsigned int prefs,
		       struct in6_addr *saddr)
{
	struct ipv6_saddr_score scores[2],
				*score = &scores[0], *hiscore = &scores[1];
	struct net *net = dev_net(dst_dev);
	struct ipv6_saddr_dst dst;
	struct net_device *dev;
	int dst_type;
+2 −1
Original line number Diff line number Diff line
@@ -93,7 +93,8 @@ static int fib6_rule_action(struct fib_rule *rule, struct flowi *flp,
			if (flags & RT6_LOOKUP_F_SRCPREF_COA)
				srcprefs |= IPV6_PREFER_SRC_COA;

			if (ipv6_dev_get_saddr(ip6_dst_idev(&rt->u.dst)->dev,
			if (ipv6_dev_get_saddr(net,
					       ip6_dst_idev(&rt->u.dst)->dev,
					       &flp->fl6_dst, srcprefs,
					       &saddr))
				goto again;
+1 −0
Original line number Diff line number Diff line
@@ -378,6 +378,7 @@ static int inet6_dump_fib(struct sk_buff *skb, struct netlink_callback *cb)

	arg.skb = skb;
	arg.cb = cb;
	arg.net = net;
	w->args = &arg;

	for (h = s_h; h < FIB_TABLE_HASHSZ; h++, s_e = 0) {
Loading