From ff3770a22dc1fc6ca3339f039feb945330d30a77 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Fri, 10 Aug 2012 17:27:36 +0400 Subject: [PATCH] net: Declare and expand a struct with newlink request We need to add payload to NEWLINK request and will have to work with it outside the restore_one_link fn. Signed-off-by: Pavel Emelyanov --- net.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/net.c b/net.c index 62720208b..a860a70da 100644 --- a/net.c +++ b/net.c @@ -140,12 +140,15 @@ static int restore_link_cb(struct nlmsghdr *hdr, void *arg) return 0; } +struct newlink_req { + struct nlmsghdr h; + struct ifinfomsg i; + char buf[1024]; +}; + static int restore_one_link(NetDeviceEntry *nde, int nlsk) { - struct { - struct nlmsghdr h; - struct ifinfomsg i; - } req; + struct newlink_req req; memset(&req, 0, sizeof(req)); @@ -160,7 +163,7 @@ static int restore_one_link(NetDeviceEntry *nde, int nlsk) /* FIXME -- restore mtu as well */ pr_info("Restoring netdev idx %d\n", nde->ifindex); - return do_rtnl_req(nlsk, &req, sizeof(req), restore_link_cb, NULL); + return do_rtnl_req(nlsk, &req, req.h.nlmsg_len, restore_link_cb, NULL); } static int restore_link(NetDeviceEntry *nde, int nlsk)