Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- From 685a5475ce93f59f8d733fd045caa778e8a0cf65 Wed Oct 21 09:00:00 2015
- From: Chris Card <ctcard@hotmail.com>
- Date: Wed, 21 Oct 2015 08:50:21 +0100
- Subject: [patch libteam] Log more detailed error messages from
- get_ifinfo_list() and retry if nl_recvmsgs() returns NLE_DUMP_INTR
- Signed-off-by: Chris Card <ctcard@hotmail.com>
- ---
- libteam/ifinfo.c | 57 +++++++++++++++++++++++++++++++++++++++-----------------
- 1 file changed, 40 insertions(+), 17 deletions(-)
- diff --git a/libteam/ifinfo.c b/libteam/ifinfo.c
- index 47b342c..9754ffa 100644
- --- a/libteam/ifinfo.c
- +++ b/libteam/ifinfo.c
- @@ -367,23 +367,46 @@ int get_ifinfo_list(struct team_handle *th)
- };
- int ret;
- - ret = nl_send_simple(th->nl_cli.sock, RTM_GETLINK, NLM_F_DUMP,
- - &rt_hdr, sizeof(rt_hdr));
- - if (ret < 0)
- - return -nl2syserr(ret);
- - orig_cb = nl_socket_get_cb(th->nl_cli.sock);
- - cb = nl_cb_clone(orig_cb);
- - nl_cb_put(orig_cb);
- - if (!cb)
- - return -ENOMEM;
- -
- - nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, valid_handler, th);
- -
- - ret = nl_recvmsgs(th->nl_cli.sock, cb);
- - nl_cb_put(cb);
- - if (ret < 0)
- - return -nl2syserr(ret);
- - return check_call_change_handlers(th, TEAM_IFINFO_CHANGE);
- + int retry = 1;
- + while (retry)
- + {
- + retry = 0;
- + ret = nl_send_simple(th->nl_cli.sock, RTM_GETLINK, NLM_F_DUMP,
- + &rt_hdr, sizeof(rt_hdr));
- + if (ret < 0)
- + {
- + err(th, "get_ifinfo_list: nl_send_simple failed: ret = %d", ret);
- + return -nl2syserr(ret);
- + }
- + orig_cb = nl_socket_get_cb(th->nl_cli.sock);
- + cb = nl_cb_clone(orig_cb);
- + nl_cb_put(orig_cb);
- + if (!cb)
- + {
- + err(th, "get_ifinfo_list: nl_cb_clone failed");
- + return -ENOMEM;
- + }
- +
- + nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, valid_handler, th);
- +
- + ret = nl_recvmsgs(th->nl_cli.sock, cb);
- + nl_cb_put(cb);
- + if (ret < 0)
- + {
- + err(th, "get_ifinfo_list: nl_recvmsgs failed: ret = %d", ret);
- + if (ret != -NLE_DUMP_INTR)
- + {
- + return -nl2syserr(ret);
- + }
- + retry = 1;
- + }
- + }
- + ret = check_call_change_handlers(th, TEAM_IFINFO_CHANGE);
- + if (ret < 0)
- + {
- + err(th, "get_ifinfo_list: check_call_change_handers failed: ret = %d", ret);
- + }
- + return ret;
- }
- int ifinfo_list_init(struct team_handle *th)
- --
- 1.8.3.1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement