diff options
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/rtnetlink.c | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 7d84db3e0597..a6882686ca3a 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -1482,6 +1482,8 @@ static int do_set_master(struct net_device *dev, int ifindex) | |||
1482 | } | 1482 | } |
1483 | 1483 | ||
1484 | #define DO_SETLINK_MODIFIED 0x01 | 1484 | #define DO_SETLINK_MODIFIED 0x01 |
1485 | /* notify flag means notify + modified. */ | ||
1486 | #define DO_SETLINK_NOTIFY 0x03 | ||
1485 | static int do_setlink(const struct sk_buff *skb, | 1487 | static int do_setlink(const struct sk_buff *skb, |
1486 | struct net_device *dev, struct ifinfomsg *ifm, | 1488 | struct net_device *dev, struct ifinfomsg *ifm, |
1487 | struct nlattr **tb, char *ifname, int status) | 1489 | struct nlattr **tb, char *ifname, int status) |
@@ -1532,7 +1534,7 @@ static int do_setlink(const struct sk_buff *skb, | |||
1532 | if (err < 0) | 1534 | if (err < 0) |
1533 | goto errout; | 1535 | goto errout; |
1534 | 1536 | ||
1535 | status |= DO_SETLINK_MODIFIED; | 1537 | status |= DO_SETLINK_NOTIFY; |
1536 | } | 1538 | } |
1537 | 1539 | ||
1538 | if (tb[IFLA_ADDRESS]) { | 1540 | if (tb[IFLA_ADDRESS]) { |
@@ -1564,7 +1566,7 @@ static int do_setlink(const struct sk_buff *skb, | |||
1564 | 1566 | ||
1565 | if (tb[IFLA_GROUP]) { | 1567 | if (tb[IFLA_GROUP]) { |
1566 | dev_set_group(dev, nla_get_u32(tb[IFLA_GROUP])); | 1568 | dev_set_group(dev, nla_get_u32(tb[IFLA_GROUP])); |
1567 | status |= DO_SETLINK_MODIFIED; | 1569 | status |= DO_SETLINK_NOTIFY; |
1568 | } | 1570 | } |
1569 | 1571 | ||
1570 | /* | 1572 | /* |
@@ -1584,7 +1586,7 @@ static int do_setlink(const struct sk_buff *skb, | |||
1584 | nla_len(tb[IFLA_IFALIAS])); | 1586 | nla_len(tb[IFLA_IFALIAS])); |
1585 | if (err < 0) | 1587 | if (err < 0) |
1586 | goto errout; | 1588 | goto errout; |
1587 | status |= DO_SETLINK_MODIFIED; | 1589 | status |= DO_SETLINK_NOTIFY; |
1588 | } | 1590 | } |
1589 | 1591 | ||
1590 | if (tb[IFLA_BROADCAST]) { | 1592 | if (tb[IFLA_BROADCAST]) { |
@@ -1616,7 +1618,7 @@ static int do_setlink(const struct sk_buff *skb, | |||
1616 | unsigned long value = nla_get_u32(tb[IFLA_TXQLEN]); | 1618 | unsigned long value = nla_get_u32(tb[IFLA_TXQLEN]); |
1617 | 1619 | ||
1618 | if (dev->tx_queue_len ^ value) | 1620 | if (dev->tx_queue_len ^ value) |
1619 | status |= DO_SETLINK_MODIFIED; | 1621 | status |= DO_SETLINK_NOTIFY; |
1620 | 1622 | ||
1621 | dev->tx_queue_len = value; | 1623 | dev->tx_queue_len = value; |
1622 | } | 1624 | } |
@@ -1629,7 +1631,7 @@ static int do_setlink(const struct sk_buff *skb, | |||
1629 | 1631 | ||
1630 | write_lock_bh(&dev_base_lock); | 1632 | write_lock_bh(&dev_base_lock); |
1631 | if (dev->link_mode ^ value) | 1633 | if (dev->link_mode ^ value) |
1632 | status |= DO_SETLINK_MODIFIED; | 1634 | status |= DO_SETLINK_NOTIFY; |
1633 | dev->link_mode = value; | 1635 | dev->link_mode = value; |
1634 | write_unlock_bh(&dev_base_lock); | 1636 | write_unlock_bh(&dev_base_lock); |
1635 | } | 1637 | } |
@@ -1645,7 +1647,7 @@ static int do_setlink(const struct sk_buff *skb, | |||
1645 | err = do_setvfinfo(dev, attr); | 1647 | err = do_setvfinfo(dev, attr); |
1646 | if (err < 0) | 1648 | if (err < 0) |
1647 | goto errout; | 1649 | goto errout; |
1648 | status |= DO_SETLINK_MODIFIED; | 1650 | status |= DO_SETLINK_NOTIFY; |
1649 | } | 1651 | } |
1650 | } | 1652 | } |
1651 | err = 0; | 1653 | err = 0; |
@@ -1675,7 +1677,7 @@ static int do_setlink(const struct sk_buff *skb, | |||
1675 | err = ops->ndo_set_vf_port(dev, vf, port); | 1677 | err = ops->ndo_set_vf_port(dev, vf, port); |
1676 | if (err < 0) | 1678 | if (err < 0) |
1677 | goto errout; | 1679 | goto errout; |
1678 | status |= DO_SETLINK_MODIFIED; | 1680 | status |= DO_SETLINK_NOTIFY; |
1679 | } | 1681 | } |
1680 | } | 1682 | } |
1681 | err = 0; | 1683 | err = 0; |
@@ -1693,7 +1695,7 @@ static int do_setlink(const struct sk_buff *skb, | |||
1693 | err = ops->ndo_set_vf_port(dev, PORT_SELF_VF, port); | 1695 | err = ops->ndo_set_vf_port(dev, PORT_SELF_VF, port); |
1694 | if (err < 0) | 1696 | if (err < 0) |
1695 | goto errout; | 1697 | goto errout; |
1696 | status |= DO_SETLINK_MODIFIED; | 1698 | status |= DO_SETLINK_NOTIFY; |
1697 | } | 1699 | } |
1698 | 1700 | ||
1699 | if (tb[IFLA_AF_SPEC]) { | 1701 | if (tb[IFLA_AF_SPEC]) { |
@@ -1710,15 +1712,20 @@ static int do_setlink(const struct sk_buff *skb, | |||
1710 | if (err < 0) | 1712 | if (err < 0) |
1711 | goto errout; | 1713 | goto errout; |
1712 | 1714 | ||
1713 | status |= DO_SETLINK_MODIFIED; | 1715 | status |= DO_SETLINK_NOTIFY; |
1714 | } | 1716 | } |
1715 | } | 1717 | } |
1716 | err = 0; | 1718 | err = 0; |
1717 | 1719 | ||
1718 | errout: | 1720 | errout: |
1719 | if (err < 0 && status & DO_SETLINK_MODIFIED) | 1721 | if (status & DO_SETLINK_MODIFIED) { |
1720 | net_warn_ratelimited("A link change request failed with some changes committed already. Interface %s may have been left with an inconsistent configuration, please check.\n", | 1722 | if (status & DO_SETLINK_NOTIFY) |
1721 | dev->name); | 1723 | netdev_state_change(dev); |
1724 | |||
1725 | if (err < 0) | ||
1726 | net_warn_ratelimited("A link change request failed with some changes committed already. Interface %s may have been left with an inconsistent configuration, please check.\n", | ||
1727 | dev->name); | ||
1728 | } | ||
1722 | 1729 | ||
1723 | return err; | 1730 | return err; |
1724 | } | 1731 | } |
@@ -2015,7 +2022,7 @@ replay: | |||
2015 | err = ops->changelink(dev, tb, data); | 2022 | err = ops->changelink(dev, tb, data); |
2016 | if (err < 0) | 2023 | if (err < 0) |
2017 | return err; | 2024 | return err; |
2018 | status |= DO_SETLINK_MODIFIED; | 2025 | status |= DO_SETLINK_NOTIFY; |
2019 | } | 2026 | } |
2020 | 2027 | ||
2021 | if (linkinfo[IFLA_INFO_SLAVE_DATA]) { | 2028 | if (linkinfo[IFLA_INFO_SLAVE_DATA]) { |
@@ -2026,7 +2033,7 @@ replay: | |||
2026 | tb, slave_data); | 2033 | tb, slave_data); |
2027 | if (err < 0) | 2034 | if (err < 0) |
2028 | return err; | 2035 | return err; |
2029 | status |= DO_SETLINK_MODIFIED; | 2036 | status |= DO_SETLINK_NOTIFY; |
2030 | } | 2037 | } |
2031 | 2038 | ||
2032 | return do_setlink(skb, dev, ifm, tb, ifname, status); | 2039 | return do_setlink(skb, dev, ifm, tb, ifname, status); |