X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Froute-table.c;h=8f5b733ceee881dff5c6f8ed1bea9c51caf87999;hb=003ce655b7116d18c86a74c50391e54990346931;hp=1afc01d06e75f84222bec25cc74a48f26e1db674;hpb=db5a101931c5393d5f9df600559882418d536878;p=sliver-openvswitch.git diff --git a/lib/route-table.c b/lib/route-table.c index 1afc01d06..8f5b733ce 100644 --- a/lib/route-table.c +++ b/lib/route-table.c @@ -223,7 +223,8 @@ route_table_reset(void) { struct nl_dump dump; struct rtgenmsg *rtmsg; - struct ofpbuf request, reply; + uint64_t reply_stub[NL_DUMP_BUFSIZE / 8]; + struct ofpbuf request, reply, buf; route_map_clear(); route_table_valid = true; @@ -238,13 +239,15 @@ route_table_reset(void) nl_dump_start(&dump, NETLINK_ROUTE, &request); ofpbuf_uninit(&request); - while (nl_dump_next(&dump, &reply)) { + ofpbuf_use_stub(&buf, reply_stub, sizeof reply_stub); + while (nl_dump_next(&dump, &reply, &buf)) { struct route_table_msg msg; if (route_table_parse(&reply, &msg)) { route_table_handle_msg(&msg); } } + ofpbuf_uninit(&buf); return nl_dump_done(&dump); } @@ -269,7 +272,7 @@ route_table_parse(struct ofpbuf *buf, struct route_table_msg *change) const struct rtmsg *rtm; const struct nlmsghdr *nlmsg; - nlmsg = buf->data; + nlmsg = ofpbuf_data(buf); rtm = ofpbuf_at(buf, NLMSG_HDRLEN, sizeof *rtm); if (rtm->rtm_family != AF_INET) { @@ -407,7 +410,8 @@ name_table_reset(void) { struct nl_dump dump; struct rtgenmsg *rtmsg; - struct ofpbuf request, reply; + uint64_t reply_stub[NL_DUMP_BUFSIZE / 8]; + struct ofpbuf request, reply, buf; name_table_valid = true; name_map_clear(); @@ -420,7 +424,8 @@ name_table_reset(void) nl_dump_start(&dump, NETLINK_ROUTE, &request); ofpbuf_uninit(&request); - while (nl_dump_next(&dump, &reply)) { + ofpbuf_use_stub(&buf, reply_stub, sizeof reply_stub); + while (nl_dump_next(&dump, &reply, &buf)) { struct rtnetlink_link_change change; if (rtnetlink_link_parse(&reply, &change) @@ -434,6 +439,7 @@ name_table_reset(void) hmap_insert(&name_map, &nn->node, hash_int(nn->ifi_index, 0)); } } + ofpbuf_uninit(&buf); return nl_dump_done(&dump); }