@@ -1683,6 +1683,7 @@ static int inet_fill_ifaddr(struct sk_buff *skb, const struct in_ifaddr *ifa,
1683
1683
struct nlmsghdr * nlh ;
1684
1684
unsigned long tstamp ;
1685
1685
u32 preferred , valid ;
1686
+ u32 flags ;
1686
1687
1687
1688
nlh = nlmsg_put (skb , args -> portid , args -> seq , args -> event , sizeof (* ifm ),
1688
1689
args -> flags );
@@ -1692,7 +1693,13 @@ static int inet_fill_ifaddr(struct sk_buff *skb, const struct in_ifaddr *ifa,
1692
1693
ifm = nlmsg_data (nlh );
1693
1694
ifm -> ifa_family = AF_INET ;
1694
1695
ifm -> ifa_prefixlen = ifa -> ifa_prefixlen ;
1695
- ifm -> ifa_flags = READ_ONCE (ifa -> ifa_flags );
1696
+
1697
+ flags = READ_ONCE (ifa -> ifa_flags );
1698
+ /* Warning : ifm->ifa_flags is an __u8, it holds only 8 bits.
1699
+ * The 32bit value is given in IFA_FLAGS attribute.
1700
+ */
1701
+ ifm -> ifa_flags = (__u8 )flags ;
1702
+
1696
1703
ifm -> ifa_scope = ifa -> ifa_scope ;
1697
1704
ifm -> ifa_index = ifa -> ifa_dev -> dev -> ifindex ;
1698
1705
@@ -1701,7 +1708,7 @@ static int inet_fill_ifaddr(struct sk_buff *skb, const struct in_ifaddr *ifa,
1701
1708
goto nla_put_failure ;
1702
1709
1703
1710
tstamp = READ_ONCE (ifa -> ifa_tstamp );
1704
- if (!(ifm -> ifa_flags & IFA_F_PERMANENT )) {
1711
+ if (!(flags & IFA_F_PERMANENT )) {
1705
1712
preferred = READ_ONCE (ifa -> ifa_preferred_lft );
1706
1713
valid = READ_ONCE (ifa -> ifa_valid_lft );
1707
1714
if (preferred != INFINITY_LIFE_TIME ) {
@@ -1732,7 +1739,7 @@ static int inet_fill_ifaddr(struct sk_buff *skb, const struct in_ifaddr *ifa,
1732
1739
nla_put_string (skb , IFA_LABEL , ifa -> ifa_label )) ||
1733
1740
(ifa -> ifa_proto &&
1734
1741
nla_put_u8 (skb , IFA_PROTO , ifa -> ifa_proto )) ||
1735
- nla_put_u32 (skb , IFA_FLAGS , ifm -> ifa_flags ) ||
1742
+ nla_put_u32 (skb , IFA_FLAGS , flags ) ||
1736
1743
(ifa -> ifa_rt_priority &&
1737
1744
nla_put_u32 (skb , IFA_RT_PRIORITY , ifa -> ifa_rt_priority )) ||
1738
1745
put_cacheinfo (skb , READ_ONCE (ifa -> ifa_cstamp ), tstamp ,
0 commit comments