Skip to content

Commit

Permalink
ipv6 route: Dump gateway based on RTF_GATEWAY flag and rt->rt6i_gateway.
Browse files Browse the repository at this point in the history
Do not depend on rt->n.

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
YOSHIFUJI Hideaki / 吉藤英明 authored and David S. Miller committed Jan 17, 2013
1 parent 8e022ee commit dd0cbf2
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions net/ipv6/route.c
Original file line number Diff line number Diff line change
Expand Up @@ -2484,7 +2484,6 @@ static int rt6_fill_node(struct net *net,
struct nlmsghdr *nlh;
long expires;
u32 table;
struct neighbour *n;

if (prefix) { /* user wants prefix routes only */
if (!(rt->rt6i_flags & RTF_PREFIX_RT)) {
Expand Down Expand Up @@ -2597,9 +2596,8 @@ static int rt6_fill_node(struct net *net,
if (rtnetlink_put_metrics(skb, dst_metrics_ptr(&rt->dst)) < 0)
goto nla_put_failure;

n = rt->n;
if (n) {
if (nla_put(skb, RTA_GATEWAY, 16, &n->primary_key) < 0)
if (rt->rt6i_flags & RTF_GATEWAY) {
if (nla_put(skb, RTA_GATEWAY, 16, &rt->rt6i_gateway) < 0)
goto nla_put_failure;
}

Expand Down Expand Up @@ -2794,7 +2792,6 @@ struct rt6_proc_arg
static int rt6_info_route(struct rt6_info *rt, void *p_arg)
{
struct seq_file *m = p_arg;
struct neighbour *n;

seq_printf(m, "%pi6 %02x ", &rt->rt6i_dst.addr, rt->rt6i_dst.plen);

Expand All @@ -2803,9 +2800,8 @@ static int rt6_info_route(struct rt6_info *rt, void *p_arg)
#else
seq_puts(m, "00000000000000000000000000000000 00 ");
#endif
n = rt->n;
if (n) {
seq_printf(m, "%pi6", n->primary_key);
if (rt->rt6i_flags & RTF_GATEWAY) {
seq_printf(m, "%pi6", &rt->rt6i_gateway);
} else {
seq_puts(m, "00000000000000000000000000000000");
}
Expand Down

0 comments on commit dd0cbf2

Please sign in to comment.