diff options
Diffstat (limited to 'net/core/rtnetlink.c')
-rw-r--r-- | net/core/rtnetlink.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index d6381c2a4693..31f29d2989fd 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -586,6 +586,7 @@ static inline size_t if_nlmsg_size(const struct net_device *dev) | |||
586 | { | 586 | { |
587 | return NLMSG_ALIGN(sizeof(struct ifinfomsg)) | 587 | return NLMSG_ALIGN(sizeof(struct ifinfomsg)) |
588 | + nla_total_size(IFNAMSIZ) /* IFLA_IFNAME */ | 588 | + nla_total_size(IFNAMSIZ) /* IFLA_IFNAME */ |
589 | + nla_total_size(IFALIASZ) /* IFLA_IFALIAS */ | ||
589 | + nla_total_size(IFNAMSIZ) /* IFLA_QDISC */ | 590 | + nla_total_size(IFNAMSIZ) /* IFLA_QDISC */ |
590 | + nla_total_size(sizeof(struct rtnl_link_ifmap)) | 591 | + nla_total_size(sizeof(struct rtnl_link_ifmap)) |
591 | + nla_total_size(sizeof(struct rtnl_link_stats)) | 592 | + nla_total_size(sizeof(struct rtnl_link_stats)) |
@@ -640,6 +641,9 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev, | |||
640 | if (txq->qdisc_sleeping) | 641 | if (txq->qdisc_sleeping) |
641 | NLA_PUT_STRING(skb, IFLA_QDISC, txq->qdisc_sleeping->ops->id); | 642 | NLA_PUT_STRING(skb, IFLA_QDISC, txq->qdisc_sleeping->ops->id); |
642 | 643 | ||
644 | if (dev->ifalias) | ||
645 | NLA_PUT_STRING(skb, IFLA_IFALIAS, dev->ifalias); | ||
646 | |||
643 | if (1) { | 647 | if (1) { |
644 | struct rtnl_link_ifmap map = { | 648 | struct rtnl_link_ifmap map = { |
645 | .mem_start = dev->mem_start, | 649 | .mem_start = dev->mem_start, |
@@ -713,6 +717,7 @@ const struct nla_policy ifla_policy[IFLA_MAX+1] = { | |||
713 | [IFLA_LINKMODE] = { .type = NLA_U8 }, | 717 | [IFLA_LINKMODE] = { .type = NLA_U8 }, |
714 | [IFLA_LINKINFO] = { .type = NLA_NESTED }, | 718 | [IFLA_LINKINFO] = { .type = NLA_NESTED }, |
715 | [IFLA_NET_NS_PID] = { .type = NLA_U32 }, | 719 | [IFLA_NET_NS_PID] = { .type = NLA_U32 }, |
720 | [IFLA_IFALIAS] = { .type = NLA_STRING, .len = IFALIASZ-1 }, | ||
716 | }; | 721 | }; |
717 | 722 | ||
718 | static const struct nla_policy ifla_info_policy[IFLA_INFO_MAX+1] = { | 723 | static const struct nla_policy ifla_info_policy[IFLA_INFO_MAX+1] = { |
@@ -853,6 +858,14 @@ static int do_setlink(struct net_device *dev, struct ifinfomsg *ifm, | |||
853 | modified = 1; | 858 | modified = 1; |
854 | } | 859 | } |
855 | 860 | ||
861 | if (tb[IFLA_IFALIAS]) { | ||
862 | err = dev_set_alias(dev, nla_data(tb[IFLA_IFALIAS]), | ||
863 | nla_len(tb[IFLA_IFALIAS])); | ||
864 | if (err < 0) | ||
865 | goto errout; | ||
866 | modified = 1; | ||
867 | } | ||
868 | |||
856 | if (tb[IFLA_BROADCAST]) { | 869 | if (tb[IFLA_BROADCAST]) { |
857 | nla_memcpy(dev->broadcast, tb[IFLA_BROADCAST], dev->addr_len); | 870 | nla_memcpy(dev->broadcast, tb[IFLA_BROADCAST], dev->addr_len); |
858 | send_addr_notify = 1; | 871 | send_addr_notify = 1; |
@@ -1027,7 +1040,7 @@ static int rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) | |||
1027 | struct nlattr *linkinfo[IFLA_INFO_MAX+1]; | 1040 | struct nlattr *linkinfo[IFLA_INFO_MAX+1]; |
1028 | int err; | 1041 | int err; |
1029 | 1042 | ||
1030 | #ifdef CONFIG_KMOD | 1043 | #ifdef CONFIG_MODULES |
1031 | replay: | 1044 | replay: |
1032 | #endif | 1045 | #endif |
1033 | err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy); | 1046 | err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy); |
@@ -1116,7 +1129,7 @@ replay: | |||
1116 | return -EOPNOTSUPP; | 1129 | return -EOPNOTSUPP; |
1117 | 1130 | ||
1118 | if (!ops) { | 1131 | if (!ops) { |
1119 | #ifdef CONFIG_KMOD | 1132 | #ifdef CONFIG_MODULES |
1120 | if (kind[0]) { | 1133 | if (kind[0]) { |
1121 | __rtnl_unlock(); | 1134 | __rtnl_unlock(); |
1122 | request_module("rtnl-link-%s", kind); | 1135 | request_module("rtnl-link-%s", kind); |