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

dn_dev: add support for IFA_FLAGS nl attribute

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Jiri Pirko and committed by
David S. Miller
9a32b860 94a12b15

+10 -5
+1 -1
include/net/dn_dev.h
··· 9 9 struct dn_dev *ifa_dev; 10 10 __le16 ifa_local; 11 11 __le16 ifa_address; 12 - __u8 ifa_flags; 12 + __u32 ifa_flags; 13 13 __u8 ifa_scope; 14 14 char ifa_label[IFNAMSIZ]; 15 15 struct rcu_head rcu;
+9 -4
net/decnet/dn_dev.c
··· 561 561 [IFA_LOCAL] = { .type = NLA_U16 }, 562 562 [IFA_LABEL] = { .type = NLA_STRING, 563 563 .len = IFNAMSIZ - 1 }, 564 + [IFA_FLAGS] = { .type = NLA_U32 }, 564 565 }; 565 566 566 567 static int dn_nl_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh) ··· 649 648 650 649 ifa->ifa_local = nla_get_le16(tb[IFA_LOCAL]); 651 650 ifa->ifa_address = nla_get_le16(tb[IFA_ADDRESS]); 652 - ifa->ifa_flags = ifm->ifa_flags; 651 + ifa->ifa_flags = tb[IFA_FLAGS] ? nla_get_u32(tb[IFA_FLAGS]) : 652 + ifm->ifa_flags; 653 653 ifa->ifa_scope = ifm->ifa_scope; 654 654 ifa->ifa_dev = dn_db; 655 655 ··· 671 669 return NLMSG_ALIGN(sizeof(struct ifaddrmsg)) 672 670 + nla_total_size(IFNAMSIZ) /* IFA_LABEL */ 673 671 + nla_total_size(2) /* IFA_ADDRESS */ 674 - + nla_total_size(2); /* IFA_LOCAL */ 672 + + nla_total_size(2) /* IFA_LOCAL */ 673 + + nla_total_size(4); /* IFA_FLAGS */ 675 674 } 676 675 677 676 static int dn_nl_fill_ifaddr(struct sk_buff *skb, struct dn_ifaddr *ifa, ··· 680 677 { 681 678 struct ifaddrmsg *ifm; 682 679 struct nlmsghdr *nlh; 680 + u32 ifa_flags = ifa->ifa_flags | IFA_F_PERMANENT; 683 681 684 682 nlh = nlmsg_put(skb, portid, seq, event, sizeof(*ifm), flags); 685 683 if (nlh == NULL) ··· 689 685 ifm = nlmsg_data(nlh); 690 686 ifm->ifa_family = AF_DECnet; 691 687 ifm->ifa_prefixlen = 16; 692 - ifm->ifa_flags = ifa->ifa_flags | IFA_F_PERMANENT; 688 + ifm->ifa_flags = ifa_flags; 693 689 ifm->ifa_scope = ifa->ifa_scope; 694 690 ifm->ifa_index = ifa->ifa_dev->dev->ifindex; 695 691 ··· 698 694 (ifa->ifa_local && 699 695 nla_put_le16(skb, IFA_LOCAL, ifa->ifa_local)) || 700 696 (ifa->ifa_label[0] && 701 - nla_put_string(skb, IFA_LABEL, ifa->ifa_label))) 697 + nla_put_string(skb, IFA_LABEL, ifa->ifa_label)) || 698 + nla_put_u32(skb, IFA_FLAGS, ifa_flags)) 702 699 goto nla_put_failure; 703 700 return nlmsg_end(skb, nlh); 704 701