Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ipv6 addrconf: Introduce addrconf_is_prefix_route() helper.

This inline function, for readability, returns if the route
is a "prefix" route regardless if it was installed by RA or by
hand.

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>

+8 -2
+8 -2
net/ipv6/addrconf.c
··· 231 231 return (dev->qdisc != &noop_qdisc); 232 232 } 233 233 234 + /* Check if a route is valid prefix route */ 235 + static inline int addrconf_is_prefix_route(const struct rt6_info *rt) 236 + { 237 + return ((rt->rt6i_flags & (RTF_GATEWAY | RTF_DEFAULT)) == 0); 238 + } 239 + 234 240 static void addrconf_del_timer(struct inet6_ifaddr *ifp) 235 241 { 236 242 if (del_timer(&ifp->timer)) ··· 783 777 ipv6_addr_prefix(&prefix, &ifp->addr, ifp->prefix_len); 784 778 rt = rt6_lookup(net, &prefix, NULL, ifp->idev->dev->ifindex, 1); 785 779 786 - if (rt && ((rt->rt6i_flags & (RTF_GATEWAY | RTF_DEFAULT)) == 0)) { 780 + if (rt && addrconf_is_prefix_route(rt)) { 787 781 if (onlink == 0) { 788 782 ip6_del_rt(rt); 789 783 rt = NULL; ··· 1794 1788 rt = rt6_lookup(dev_net(dev), &pinfo->prefix, NULL, 1795 1789 dev->ifindex, 1); 1796 1790 1797 - if (rt && ((rt->rt6i_flags & (RTF_GATEWAY | RTF_DEFAULT)) == 0)) { 1791 + if (rt && addrconf_is_prefix_route(rt)) { 1798 1792 /* Autoconf prefix route */ 1799 1793 if (valid_lft == 0) { 1800 1794 ip6_del_rt(rt);