diff options
author | Hans Dedecker <dedeckeh@gmail.com> | 2014-11-13 15:57:57 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2014-11-19 09:30:26 +0100 |
commit | b3a698e7b6c099203dcb4227a21813948b176e3b (patch) | |
tree | 7031bbaf9281379e021bfa4ecf2c606868abee97 /system-linux.c | |
parent | fe08cfd2bfb389f7c174e2dd1561ba4a381db213 (diff) |
netifd: Remove superfluous system_if_resolve calls
Don't resolve the ifindex of the parent device again
when adding vlandev and macvlan devices as the ifindex
has already been resolved.
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
Diffstat (limited to 'system-linux.c')
-rw-r--r-- | system-linux.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/system-linux.c b/system-linux.c index 6a6028c..01c3deb 100644 --- a/system-linux.c +++ b/system-linux.c @@ -760,7 +760,6 @@ int system_macvlan_add(struct device *macvlan, struct device *dev, struct macvla struct nl_msg *msg; struct nlattr *linkinfo, *data; struct ifinfomsg iim = { .ifi_family = AF_UNSPEC, }; - int ifindex = system_if_resolve(dev); int i, rv; static const struct { const char *name; @@ -772,9 +771,6 @@ int system_macvlan_add(struct device *macvlan, struct device *dev, struct macvla { "passthru", MACVLAN_MODE_PASSTHRU }, }; - if (ifindex == 0) - return -ENOENT; - msg = nlmsg_alloc_simple(RTM_NEWLINK, NLM_F_REQUEST | NLM_F_CREATE | NLM_F_EXCL); if (!msg) @@ -785,7 +781,7 @@ int system_macvlan_add(struct device *macvlan, struct device *dev, struct macvla if (cfg->flags & MACVLAN_OPT_MACADDR) nla_put(msg, IFLA_ADDRESS, sizeof(cfg->macaddr), cfg->macaddr); nla_put_string(msg, IFLA_IFNAME, macvlan->ifname); - nla_put_u32(msg, IFLA_LINK, ifindex); + nla_put_u32(msg, IFLA_LINK, dev->ifindex); if (!(linkinfo = nla_nest_start(msg, IFLA_LINKINFO))) goto nla_put_failure; @@ -877,12 +873,8 @@ int system_vlandev_add(struct device *vlandev, struct device *dev, struct vlande struct nl_msg *msg; struct nlattr *linkinfo, *data; struct ifinfomsg iim = { .ifi_family = AF_UNSPEC }; - int ifindex = system_if_resolve(dev); int rv; - if (ifindex == 0) - return -ENOENT; - msg = nlmsg_alloc_simple(RTM_NEWLINK, NLM_F_REQUEST | NLM_F_CREATE | NLM_F_EXCL); if (!msg) @@ -890,7 +882,7 @@ int system_vlandev_add(struct device *vlandev, struct device *dev, struct vlande nlmsg_append(msg, &iim, sizeof(iim), 0); nla_put_string(msg, IFLA_IFNAME, vlandev->ifname); - nla_put_u32(msg, IFLA_LINK, ifindex); + nla_put_u32(msg, IFLA_LINK, dev->ifindex); if (!(linkinfo = nla_nest_start(msg, IFLA_LINKINFO))) goto nla_put_failure; |