aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/addrconf.c
diff options
context:
space:
mode:
authorYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>2008-05-12 12:16:24 -0400
committerYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>2008-06-11 13:38:14 -0400
commit2b5ead46442d80928cce987ae6acf3fe99968ad8 (patch)
treed3d33e8b9ba9b08a24a0e1f58d1d5675ab5da8e1 /net/ipv6/addrconf.c
parent0399e5f07ad7024f70881d44f19d767d3f25a980 (diff)
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>
Diffstat (limited to 'net/ipv6/addrconf.c')
-rw-r--r--net/ipv6/addrconf.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 147588f4c7c0..9ea4e62741ee 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -231,6 +231,12 @@ static inline int addrconf_qdisc_ok(struct net_device *dev)
231 return (dev->qdisc != &noop_qdisc); 231 return (dev->qdisc != &noop_qdisc);
232} 232}
233 233
234/* Check if a route is valid prefix route */
235static inline int addrconf_is_prefix_route(const struct rt6_info *rt)
236{
237 return ((rt->rt6i_flags & (RTF_GATEWAY | RTF_DEFAULT)) == 0);
238}
239
234static void addrconf_del_timer(struct inet6_ifaddr *ifp) 240static void addrconf_del_timer(struct inet6_ifaddr *ifp)
235{ 241{
236 if (del_timer(&ifp->timer)) 242 if (del_timer(&ifp->timer))
@@ -777,7 +783,7 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp)
777 ipv6_addr_prefix(&prefix, &ifp->addr, ifp->prefix_len); 783 ipv6_addr_prefix(&prefix, &ifp->addr, ifp->prefix_len);
778 rt = rt6_lookup(net, &prefix, NULL, ifp->idev->dev->ifindex, 1); 784 rt = rt6_lookup(net, &prefix, NULL, ifp->idev->dev->ifindex, 1);
779 785
780 if (rt && ((rt->rt6i_flags & (RTF_GATEWAY | RTF_DEFAULT)) == 0)) { 786 if (rt && addrconf_is_prefix_route(rt)) {
781 if (onlink == 0) { 787 if (onlink == 0) {
782 ip6_del_rt(rt); 788 ip6_del_rt(rt);
783 rt = NULL; 789 rt = NULL;
@@ -1788,7 +1794,7 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len)
1788 rt = rt6_lookup(dev_net(dev), &pinfo->prefix, NULL, 1794 rt = rt6_lookup(dev_net(dev), &pinfo->prefix, NULL,
1789 dev->ifindex, 1); 1795 dev->ifindex, 1);
1790 1796
1791 if (rt && ((rt->rt6i_flags & (RTF_GATEWAY | RTF_DEFAULT)) == 0)) { 1797 if (rt && addrconf_is_prefix_route(rt)) {
1792 /* Autoconf prefix route */ 1798 /* Autoconf prefix route */
1793 if (valid_lft == 0) { 1799 if (valid_lft == 0) {
1794 ip6_del_rt(rt); 1800 ip6_del_rt(rt);