diff options
author | David S. Miller <davem@davemloft.net> | 2013-12-10 21:50:06 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-12-10 21:50:06 -0500 |
commit | 22a93216140e5097e8d9d2f99784cfd1c6158ee6 (patch) | |
tree | fca3967a7e708dea3b42ee80b26e9deabe0be57f | |
parent | 94a12b15e4c575e0aa0ba5e24a4f213163a823d0 (diff) | |
parent | ad6c81359fc3e6086d1d6f91acda9d5d0e64b2c3 (diff) |
Merge branch 'ifla_flags'
Jiri Pirko says:
====================
add support for IFA_FLAGS nl attribute
As this was recently added for ipv6, add it for the rest of occurences
as requested by DaveM.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/linux/inetdevice.h | 2 | ||||
-rw-r--r-- | include/net/dn_dev.h | 2 | ||||
-rw-r--r-- | net/decnet/dn_dev.c | 13 | ||||
-rw-r--r-- | net/ipv4/devinet.c | 8 |
4 files changed, 17 insertions, 8 deletions
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h index ae174ca565c9..562e5c7c5d35 100644 --- a/include/linux/inetdevice.h +++ b/include/linux/inetdevice.h | |||
@@ -136,8 +136,8 @@ struct in_ifaddr { | |||
136 | __be32 ifa_mask; | 136 | __be32 ifa_mask; |
137 | __be32 ifa_broadcast; | 137 | __be32 ifa_broadcast; |
138 | unsigned char ifa_scope; | 138 | unsigned char ifa_scope; |
139 | unsigned char ifa_flags; | ||
140 | unsigned char ifa_prefixlen; | 139 | unsigned char ifa_prefixlen; |
140 | __u32 ifa_flags; | ||
141 | char ifa_label[IFNAMSIZ]; | 141 | char ifa_label[IFNAMSIZ]; |
142 | 142 | ||
143 | /* In seconds, relative to tstamp. Expiry is at tstamp + HZ * lft. */ | 143 | /* In seconds, relative to tstamp. Expiry is at tstamp + HZ * lft. */ |
diff --git a/include/net/dn_dev.h b/include/net/dn_dev.h index 20b5ab06032d..197886cd7bdd 100644 --- a/include/net/dn_dev.h +++ b/include/net/dn_dev.h | |||
@@ -9,7 +9,7 @@ struct dn_ifaddr { | |||
9 | struct dn_dev *ifa_dev; | 9 | struct dn_dev *ifa_dev; |
10 | __le16 ifa_local; | 10 | __le16 ifa_local; |
11 | __le16 ifa_address; | 11 | __le16 ifa_address; |
12 | __u8 ifa_flags; | 12 | __u32 ifa_flags; |
13 | __u8 ifa_scope; | 13 | __u8 ifa_scope; |
14 | char ifa_label[IFNAMSIZ]; | 14 | char ifa_label[IFNAMSIZ]; |
15 | struct rcu_head rcu; | 15 | struct rcu_head rcu; |
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c index dd0dfb25f4b1..a603823a3e27 100644 --- a/net/decnet/dn_dev.c +++ b/net/decnet/dn_dev.c | |||
@@ -561,6 +561,7 @@ static const struct nla_policy dn_ifa_policy[IFA_MAX+1] = { | |||
561 | [IFA_LOCAL] = { .type = NLA_U16 }, | 561 | [IFA_LOCAL] = { .type = NLA_U16 }, |
562 | [IFA_LABEL] = { .type = NLA_STRING, | 562 | [IFA_LABEL] = { .type = NLA_STRING, |
563 | .len = IFNAMSIZ - 1 }, | 563 | .len = IFNAMSIZ - 1 }, |
564 | [IFA_FLAGS] = { .type = NLA_U32 }, | ||
564 | }; | 565 | }; |
565 | 566 | ||
566 | static int dn_nl_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh) | 567 | static int dn_nl_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh) |
@@ -648,7 +649,8 @@ static int dn_nl_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
648 | 649 | ||
649 | ifa->ifa_local = nla_get_le16(tb[IFA_LOCAL]); | 650 | ifa->ifa_local = nla_get_le16(tb[IFA_LOCAL]); |
650 | ifa->ifa_address = nla_get_le16(tb[IFA_ADDRESS]); | 651 | ifa->ifa_address = nla_get_le16(tb[IFA_ADDRESS]); |
651 | ifa->ifa_flags = ifm->ifa_flags; | 652 | ifa->ifa_flags = tb[IFA_FLAGS] ? nla_get_u32(tb[IFA_FLAGS]) : |
653 | ifm->ifa_flags; | ||
652 | ifa->ifa_scope = ifm->ifa_scope; | 654 | ifa->ifa_scope = ifm->ifa_scope; |
653 | ifa->ifa_dev = dn_db; | 655 | ifa->ifa_dev = dn_db; |
654 | 656 | ||
@@ -669,7 +671,8 @@ static inline size_t dn_ifaddr_nlmsg_size(void) | |||
669 | return NLMSG_ALIGN(sizeof(struct ifaddrmsg)) | 671 | return NLMSG_ALIGN(sizeof(struct ifaddrmsg)) |
670 | + nla_total_size(IFNAMSIZ) /* IFA_LABEL */ | 672 | + nla_total_size(IFNAMSIZ) /* IFA_LABEL */ |
671 | + nla_total_size(2) /* IFA_ADDRESS */ | 673 | + nla_total_size(2) /* IFA_ADDRESS */ |
672 | + nla_total_size(2); /* IFA_LOCAL */ | 674 | + nla_total_size(2) /* IFA_LOCAL */ |
675 | + nla_total_size(4); /* IFA_FLAGS */ | ||
673 | } | 676 | } |
674 | 677 | ||
675 | static int dn_nl_fill_ifaddr(struct sk_buff *skb, struct dn_ifaddr *ifa, | 678 | static int dn_nl_fill_ifaddr(struct sk_buff *skb, struct dn_ifaddr *ifa, |
@@ -677,6 +680,7 @@ static int dn_nl_fill_ifaddr(struct sk_buff *skb, struct dn_ifaddr *ifa, | |||
677 | { | 680 | { |
678 | struct ifaddrmsg *ifm; | 681 | struct ifaddrmsg *ifm; |
679 | struct nlmsghdr *nlh; | 682 | struct nlmsghdr *nlh; |
683 | u32 ifa_flags = ifa->ifa_flags | IFA_F_PERMANENT; | ||
680 | 684 | ||
681 | nlh = nlmsg_put(skb, portid, seq, event, sizeof(*ifm), flags); | 685 | nlh = nlmsg_put(skb, portid, seq, event, sizeof(*ifm), flags); |
682 | if (nlh == NULL) | 686 | if (nlh == NULL) |
@@ -685,7 +689,7 @@ static int dn_nl_fill_ifaddr(struct sk_buff *skb, struct dn_ifaddr *ifa, | |||
685 | ifm = nlmsg_data(nlh); | 689 | ifm = nlmsg_data(nlh); |
686 | ifm->ifa_family = AF_DECnet; | 690 | ifm->ifa_family = AF_DECnet; |
687 | ifm->ifa_prefixlen = 16; | 691 | ifm->ifa_prefixlen = 16; |
688 | ifm->ifa_flags = ifa->ifa_flags | IFA_F_PERMANENT; | 692 | ifm->ifa_flags = ifa_flags; |
689 | ifm->ifa_scope = ifa->ifa_scope; | 693 | ifm->ifa_scope = ifa->ifa_scope; |
690 | ifm->ifa_index = ifa->ifa_dev->dev->ifindex; | 694 | ifm->ifa_index = ifa->ifa_dev->dev->ifindex; |
691 | 695 | ||
@@ -694,7 +698,8 @@ static int dn_nl_fill_ifaddr(struct sk_buff *skb, struct dn_ifaddr *ifa, | |||
694 | (ifa->ifa_local && | 698 | (ifa->ifa_local && |
695 | nla_put_le16(skb, IFA_LOCAL, ifa->ifa_local)) || | 699 | nla_put_le16(skb, IFA_LOCAL, ifa->ifa_local)) || |
696 | (ifa->ifa_label[0] && | 700 | (ifa->ifa_label[0] && |
697 | nla_put_string(skb, IFA_LABEL, ifa->ifa_label))) | 701 | nla_put_string(skb, IFA_LABEL, ifa->ifa_label)) || |
702 | nla_put_u32(skb, IFA_FLAGS, ifa_flags)) | ||
698 | goto nla_put_failure; | 703 | goto nla_put_failure; |
699 | return nlmsg_end(skb, nlh); | 704 | return nlmsg_end(skb, nlh); |
700 | 705 | ||
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 43065be36301..6f49efc9d4b7 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -99,6 +99,7 @@ static const struct nla_policy ifa_ipv4_policy[IFA_MAX+1] = { | |||
99 | [IFA_BROADCAST] = { .type = NLA_U32 }, | 99 | [IFA_BROADCAST] = { .type = NLA_U32 }, |
100 | [IFA_LABEL] = { .type = NLA_STRING, .len = IFNAMSIZ - 1 }, | 100 | [IFA_LABEL] = { .type = NLA_STRING, .len = IFNAMSIZ - 1 }, |
101 | [IFA_CACHEINFO] = { .len = sizeof(struct ifa_cacheinfo) }, | 101 | [IFA_CACHEINFO] = { .len = sizeof(struct ifa_cacheinfo) }, |
102 | [IFA_FLAGS] = { .type = NLA_U32 }, | ||
102 | }; | 103 | }; |
103 | 104 | ||
104 | #define IN4_ADDR_HSIZE_SHIFT 8 | 105 | #define IN4_ADDR_HSIZE_SHIFT 8 |
@@ -757,7 +758,8 @@ static struct in_ifaddr *rtm_to_ifaddr(struct net *net, struct nlmsghdr *nlh, | |||
757 | INIT_HLIST_NODE(&ifa->hash); | 758 | INIT_HLIST_NODE(&ifa->hash); |
758 | ifa->ifa_prefixlen = ifm->ifa_prefixlen; | 759 | ifa->ifa_prefixlen = ifm->ifa_prefixlen; |
759 | ifa->ifa_mask = inet_make_mask(ifm->ifa_prefixlen); | 760 | ifa->ifa_mask = inet_make_mask(ifm->ifa_prefixlen); |
760 | ifa->ifa_flags = ifm->ifa_flags; | 761 | ifa->ifa_flags = tb[IFA_FLAGS] ? nla_get_u32(tb[IFA_FLAGS]) : |
762 | ifm->ifa_flags; | ||
761 | ifa->ifa_scope = ifm->ifa_scope; | 763 | ifa->ifa_scope = ifm->ifa_scope; |
762 | ifa->ifa_dev = in_dev; | 764 | ifa->ifa_dev = in_dev; |
763 | 765 | ||
@@ -1437,7 +1439,8 @@ static size_t inet_nlmsg_size(void) | |||
1437 | + nla_total_size(4) /* IFA_ADDRESS */ | 1439 | + nla_total_size(4) /* IFA_ADDRESS */ |
1438 | + nla_total_size(4) /* IFA_LOCAL */ | 1440 | + nla_total_size(4) /* IFA_LOCAL */ |
1439 | + nla_total_size(4) /* IFA_BROADCAST */ | 1441 | + nla_total_size(4) /* IFA_BROADCAST */ |
1440 | + nla_total_size(IFNAMSIZ); /* IFA_LABEL */ | 1442 | + nla_total_size(IFNAMSIZ) /* IFA_LABEL */ |
1443 | + nla_total_size(4); /* IFA_FLAGS */ | ||
1441 | } | 1444 | } |
1442 | 1445 | ||
1443 | static inline u32 cstamp_delta(unsigned long cstamp) | 1446 | static inline u32 cstamp_delta(unsigned long cstamp) |
@@ -1505,6 +1508,7 @@ static int inet_fill_ifaddr(struct sk_buff *skb, struct in_ifaddr *ifa, | |||
1505 | nla_put_be32(skb, IFA_BROADCAST, ifa->ifa_broadcast)) || | 1508 | nla_put_be32(skb, IFA_BROADCAST, ifa->ifa_broadcast)) || |
1506 | (ifa->ifa_label[0] && | 1509 | (ifa->ifa_label[0] && |
1507 | nla_put_string(skb, IFA_LABEL, ifa->ifa_label)) || | 1510 | nla_put_string(skb, IFA_LABEL, ifa->ifa_label)) || |
1511 | nla_put_u32(skb, IFA_FLAGS, ifa->ifa_flags) || | ||
1508 | put_cacheinfo(skb, ifa->ifa_cstamp, ifa->ifa_tstamp, | 1512 | put_cacheinfo(skb, ifa->ifa_cstamp, ifa->ifa_tstamp, |
1509 | preferred, valid)) | 1513 | preferred, valid)) |
1510 | goto nla_put_failure; | 1514 | goto nla_put_failure; |