diff options
author | Thomas Haller <thaller@redhat.com> | 2014-01-15 09:36:58 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-01-15 20:00:40 -0500 |
commit | 761aac737eb11901c382a3f021dead59a26983fc (patch) | |
tree | 0153d7759a5b2914fe53667396764e71a67bd141 /net/ipv6 | |
parent | 6631c5cea8687cf4d36327fdbceb0691cd5d2e29 (diff) |
ipv6 addrconf: add IFA_F_NOPREFIXROUTE flag to suppress creation of IP6 routes
When adding/modifying an IPv6 address, the userspace application needs
a way to suppress adding a prefix route. This is for example relevant
together with IFA_F_MANAGERTEMPADDR, where userspace creates autoconf
generated addresses, but depending on on-link, no route for the
prefix should be added.
Signed-off-by: Thomas Haller <thaller@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/addrconf.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 1b2e4ee3ce5e..85100c1ac761 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -2434,8 +2434,11 @@ static int inet6_addr_add(struct net *net, int ifindex, | |||
2434 | valid_lft, prefered_lft); | 2434 | valid_lft, prefered_lft); |
2435 | 2435 | ||
2436 | if (!IS_ERR(ifp)) { | 2436 | if (!IS_ERR(ifp)) { |
2437 | addrconf_prefix_route(&ifp->addr, ifp->prefix_len, dev, | 2437 | if (!(ifa_flags & IFA_F_NOPREFIXROUTE)) { |
2438 | expires, flags); | 2438 | addrconf_prefix_route(&ifp->addr, ifp->prefix_len, dev, |
2439 | expires, flags); | ||
2440 | } | ||
2441 | |||
2439 | /* | 2442 | /* |
2440 | * Note that section 3.1 of RFC 4429 indicates | 2443 | * Note that section 3.1 of RFC 4429 indicates |
2441 | * that the Optimistic flag should not be set for | 2444 | * that the Optimistic flag should not be set for |
@@ -3662,7 +3665,8 @@ static int inet6_addr_modify(struct inet6_ifaddr *ifp, u32 ifa_flags, | |||
3662 | spin_lock_bh(&ifp->lock); | 3665 | spin_lock_bh(&ifp->lock); |
3663 | was_managetempaddr = ifp->flags & IFA_F_MANAGETEMPADDR; | 3666 | was_managetempaddr = ifp->flags & IFA_F_MANAGETEMPADDR; |
3664 | ifp->flags &= ~(IFA_F_DEPRECATED | IFA_F_PERMANENT | IFA_F_NODAD | | 3667 | ifp->flags &= ~(IFA_F_DEPRECATED | IFA_F_PERMANENT | IFA_F_NODAD | |
3665 | IFA_F_HOMEADDRESS | IFA_F_MANAGETEMPADDR); | 3668 | IFA_F_HOMEADDRESS | IFA_F_MANAGETEMPADDR | |
3669 | IFA_F_NOPREFIXROUTE); | ||
3666 | ifp->flags |= ifa_flags; | 3670 | ifp->flags |= ifa_flags; |
3667 | ifp->tstamp = jiffies; | 3671 | ifp->tstamp = jiffies; |
3668 | ifp->valid_lft = valid_lft; | 3672 | ifp->valid_lft = valid_lft; |
@@ -3672,8 +3676,10 @@ static int inet6_addr_modify(struct inet6_ifaddr *ifp, u32 ifa_flags, | |||
3672 | if (!(ifp->flags&IFA_F_TENTATIVE)) | 3676 | if (!(ifp->flags&IFA_F_TENTATIVE)) |
3673 | ipv6_ifa_notify(0, ifp); | 3677 | ipv6_ifa_notify(0, ifp); |
3674 | 3678 | ||
3675 | addrconf_prefix_route(&ifp->addr, ifp->prefix_len, ifp->idev->dev, | 3679 | if (!(ifa_flags & IFA_F_NOPREFIXROUTE)) { |
3676 | expires, flags); | 3680 | addrconf_prefix_route(&ifp->addr, ifp->prefix_len, ifp->idev->dev, |
3681 | expires, flags); | ||
3682 | } | ||
3677 | 3683 | ||
3678 | if (was_managetempaddr || ifp->flags & IFA_F_MANAGETEMPADDR) { | 3684 | if (was_managetempaddr || ifp->flags & IFA_F_MANAGETEMPADDR) { |
3679 | if (was_managetempaddr && !(ifp->flags & IFA_F_MANAGETEMPADDR)) | 3685 | if (was_managetempaddr && !(ifp->flags & IFA_F_MANAGETEMPADDR)) |
@@ -3727,7 +3733,8 @@ inet6_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
3727 | ifa_flags = tb[IFA_FLAGS] ? nla_get_u32(tb[IFA_FLAGS]) : ifm->ifa_flags; | 3733 | ifa_flags = tb[IFA_FLAGS] ? nla_get_u32(tb[IFA_FLAGS]) : ifm->ifa_flags; |
3728 | 3734 | ||
3729 | /* We ignore other flags so far. */ | 3735 | /* We ignore other flags so far. */ |
3730 | ifa_flags &= IFA_F_NODAD | IFA_F_HOMEADDRESS | IFA_F_MANAGETEMPADDR; | 3736 | ifa_flags &= IFA_F_NODAD | IFA_F_HOMEADDRESS | IFA_F_MANAGETEMPADDR | |
3737 | IFA_F_NOPREFIXROUTE; | ||
3731 | 3738 | ||
3732 | ifa = ipv6_get_ifaddr(net, pfx, dev, 1); | 3739 | ifa = ipv6_get_ifaddr(net, pfx, dev, 1); |
3733 | if (ifa == NULL) { | 3740 | if (ifa == NULL) { |