Commit dd0cbf29 authored by YOSHIFUJI Hideaki / 吉藤英明's avatar YOSHIFUJI Hideaki / 吉藤英明 Committed by David S. Miller

ipv6 route: Dump gateway based on RTF_GATEWAY flag and rt->rt6i_gateway.

Do not depend on rt->n.
Signed-off-by: default avatarYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8e022ee6
...@@ -2484,7 +2484,6 @@ static int rt6_fill_node(struct net *net, ...@@ -2484,7 +2484,6 @@ static int rt6_fill_node(struct net *net,
struct nlmsghdr *nlh; struct nlmsghdr *nlh;
long expires; long expires;
u32 table; u32 table;
struct neighbour *n;
if (prefix) { /* user wants prefix routes only */ if (prefix) { /* user wants prefix routes only */
if (!(rt->rt6i_flags & RTF_PREFIX_RT)) { if (!(rt->rt6i_flags & RTF_PREFIX_RT)) {
...@@ -2597,9 +2596,8 @@ static int rt6_fill_node(struct net *net, ...@@ -2597,9 +2596,8 @@ static int rt6_fill_node(struct net *net,
if (rtnetlink_put_metrics(skb, dst_metrics_ptr(&rt->dst)) < 0) if (rtnetlink_put_metrics(skb, dst_metrics_ptr(&rt->dst)) < 0)
goto nla_put_failure; goto nla_put_failure;
n = rt->n; if (rt->rt6i_flags & RTF_GATEWAY) {
if (n) { if (nla_put(skb, RTA_GATEWAY, 16, &rt->rt6i_gateway) < 0)
if (nla_put(skb, RTA_GATEWAY, 16, &n->primary_key) < 0)
goto nla_put_failure; goto nla_put_failure;
} }
...@@ -2794,7 +2792,6 @@ struct rt6_proc_arg ...@@ -2794,7 +2792,6 @@ struct rt6_proc_arg
static int rt6_info_route(struct rt6_info *rt, void *p_arg) static int rt6_info_route(struct rt6_info *rt, void *p_arg)
{ {
struct seq_file *m = p_arg; struct seq_file *m = p_arg;
struct neighbour *n;
seq_printf(m, "%pi6 %02x ", &rt->rt6i_dst.addr, rt->rt6i_dst.plen); seq_printf(m, "%pi6 %02x ", &rt->rt6i_dst.addr, rt->rt6i_dst.plen);
...@@ -2803,9 +2800,8 @@ static int rt6_info_route(struct rt6_info *rt, void *p_arg) ...@@ -2803,9 +2800,8 @@ static int rt6_info_route(struct rt6_info *rt, void *p_arg)
#else #else
seq_puts(m, "00000000000000000000000000000000 00 "); seq_puts(m, "00000000000000000000000000000000 00 ");
#endif #endif
n = rt->n; if (rt->rt6i_flags & RTF_GATEWAY) {
if (n) { seq_printf(m, "%pi6", &rt->rt6i_gateway);
seq_printf(m, "%pi6", n->primary_key);
} else { } else {
seq_puts(m, "00000000000000000000000000000000"); seq_puts(m, "00000000000000000000000000000000");
} }
......
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