From cd70f3f522e04b4d2fa80ae10292379bf223a53b Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 28 Dec 2011 10:37:12 -0800 Subject: [PATCH] libnetlink: remove unused junk callback Both rtnl_talk and rtnl_dump had a callback for handling portions of netlink message that do not match the correct pid or seq. But this callback was never used by any part of iproute2 so remove it. --- genl/ctrl.c | 6 +++--- include/libnetlink.h | 15 ++++----------- ip/ipaddress.c | 12 +++--------- ip/ipaddrlabel.c | 8 ++++---- ip/iplink.c | 4 ++-- ip/ipneigh.c | 6 +++--- ip/ipntable.c | 4 ++-- ip/iproute.c | 12 ++++++------ ip/iprule.c | 8 ++++---- ip/link_gre.c | 2 +- ip/rtmon.c | 2 +- ip/xfrm_policy.c | 12 ++++++------ ip/xfrm_state.c | 16 ++++++++-------- lib/libnetlink.c | 29 ++++++----------------------- lib/ll_map.c | 2 +- misc/ifstat.c | 2 +- tc/m_action.c | 8 ++++---- tc/tc_class.c | 4 ++-- tc/tc_filter.c | 4 ++-- tc/tc_qdisc.c | 4 ++-- 20 files changed, 65 insertions(+), 95 deletions(-) diff --git a/genl/ctrl.c b/genl/ctrl.c index 38a9761..58d13be 100644 --- a/genl/ctrl.c +++ b/genl/ctrl.c @@ -67,7 +67,7 @@ int genl_ctrl_resolve_family(const char *family) addattr_l(nlh, 128, CTRL_ATTR_FAMILY_NAME, family, strlen(family) + 1); - if (rtnl_talk(&rth, nlh, 0, 0, nlh, NULL, NULL) < 0) { + if (rtnl_talk(&rth, nlh, 0, 0, nlh) < 0) { fprintf(stderr, "Error talking to the kernel\n"); goto errout; } @@ -334,7 +334,7 @@ static int ctrl_list(int cmd, int argc, char **argv) goto ctrl_done; } - if (rtnl_talk(&rth, nlh, 0, 0, nlh, NULL, NULL) < 0) { + if (rtnl_talk(&rth, nlh, 0, 0, nlh) < 0) { fprintf(stderr, "Error talking to the kernel\n"); goto ctrl_done; } @@ -355,7 +355,7 @@ static int ctrl_list(int cmd, int argc, char **argv) goto ctrl_done; } - rtnl_dump_filter(&rth, print_ctrl, stdout, NULL, NULL); + rtnl_dump_filter(&rth, print_ctrl, stdout); } diff --git a/include/libnetlink.h b/include/libnetlink.h index c54c7f6..a828032 100644 --- a/include/libnetlink.h +++ b/include/libnetlink.h @@ -32,21 +32,14 @@ struct rtnl_dump_filter_arg { rtnl_filter_t filter; void *arg1; - rtnl_filter_t junk; - void *arg2; }; extern int rtnl_dump_filter_l(struct rtnl_handle *rth, const struct rtnl_dump_filter_arg *arg); extern int rtnl_dump_filter(struct rtnl_handle *rth, rtnl_filter_t filter, - void *arg1, - rtnl_filter_t junk, - void *arg2); - + void *arg); extern int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, pid_t peer, - unsigned groups, struct nlmsghdr *answer, - rtnl_filter_t junk, - void *jarg); + unsigned groups, struct nlmsghdr *answer); extern int rtnl_send(struct rtnl_handle *rth, const void *buf, int); extern int rtnl_send_check(struct rtnl_handle *rth, const void *buf, int); @@ -74,8 +67,8 @@ extern int __parse_rtattr_nested_compat(struct rtattr *tb[], int max, struct rta (parse_rtattr((tb), (max), RTA_DATA(rta), RTA_PAYLOAD(rta))) #define parse_rtattr_nested_compat(tb, max, rta, data, len) \ -({ data = RTA_PAYLOAD(rta) >= len ? RTA_DATA(rta) : NULL; \ - __parse_rtattr_nested_compat(tb, max, rta, len); }) + ({ data = RTA_PAYLOAD(rta) >= len ? RTA_DATA(rta) : NULL; \ + __parse_rtattr_nested_compat(tb, max, rta, len); }) extern int rtnl_listen(struct rtnl_handle *, rtnl_filter_t handler, void *jarg); diff --git a/ip/ipaddress.c b/ip/ipaddress.c index 2f2cabd..4a0ffd6 100644 --- a/ip/ipaddress.c +++ b/ip/ipaddress.c @@ -833,7 +833,7 @@ static int ipaddr_list_or_flush(int argc, char **argv, int flush) exit(1); } - if (rtnl_dump_filter(&rth, store_nlmsg, &linfo, NULL, NULL) < 0) { + if (rtnl_dump_filter(&rth, store_nlmsg, &linfo) < 0) { fprintf(stderr, "Dump terminated\n"); exit(1); } @@ -859,20 +859,14 @@ static int ipaddr_list_or_flush(int argc, char **argv, int flush) { .filter = print_addrinfo_secondary, .arg1 = stdout, - .junk = NULL, - .arg2 = NULL }, { .filter = print_addrinfo_primary, .arg1 = stdout, - .junk = NULL, - .arg2 = NULL }, { .filter = NULL, .arg1 = NULL, - .junk = NULL, - .arg2 = NULL }, }; if (rtnl_wilddump_request(&rth, filter.family, RTM_GETADDR) < 0) { @@ -923,7 +917,7 @@ flush_done: exit(1); } - if (rtnl_dump_filter(&rth, store_nlmsg, &ainfo, NULL, NULL) < 0) { + if (rtnl_dump_filter(&rth, store_nlmsg, &ainfo) < 0) { fprintf(stderr, "Dump terminated\n"); exit(1); } @@ -1214,7 +1208,7 @@ static int ipaddr_modify(int cmd, int flags, int argc, char **argv) sizeof(cinfo)); } - if (rtnl_talk(&rth, &req.n, 0, 0, NULL, NULL, NULL) < 0) + if (rtnl_talk(&rth, &req.n, 0, 0, NULL) < 0) return -2; return 0; diff --git a/ip/ipaddrlabel.c b/ip/ipaddrlabel.c index a71855d..eb6a48c 100644 --- a/ip/ipaddrlabel.c +++ b/ip/ipaddrlabel.c @@ -114,7 +114,7 @@ static int ipaddrlabel_list(int argc, char **argv) return 1; } - if (rtnl_dump_filter(&rth, print_addrlabel, stdout, NULL, NULL) < 0) { + if (rtnl_dump_filter(&rth, print_addrlabel, stdout) < 0) { fprintf(stderr, "Dump terminated\n"); return 1; } @@ -183,7 +183,7 @@ static int ipaddrlabel_modify(int cmd, int argc, char **argv) if (req.ifal.ifal_family == AF_UNSPEC) req.ifal.ifal_family = AF_INET6; - if (rtnl_talk(&rth, &req.n, 0, 0, NULL, NULL, NULL) < 0) + if (rtnl_talk(&rth, &req.n, 0, 0, NULL) < 0) return 2; return 0; @@ -210,7 +210,7 @@ static int flush_addrlabel(const struct sockaddr_nl *who, struct nlmsghdr *n, vo if (rtnl_open(&rth2, 0) < 0) return -1; - if (rtnl_talk(&rth2, n, 0, 0, NULL, NULL, NULL) < 0) + if (rtnl_talk(&rth2, n, 0, 0, NULL) < 0) return -2; rtnl_close(&rth2); @@ -236,7 +236,7 @@ static int ipaddrlabel_flush(int argc, char **argv) return 1; } - if (rtnl_dump_filter(&rth, flush_addrlabel, NULL, NULL, NULL) < 0) { + if (rtnl_dump_filter(&rth, flush_addrlabel, NULL) < 0) { fprintf(stderr, "Flush terminated\n"); return 1; } diff --git a/ip/iplink.c b/ip/iplink.c index d41605b..6b051b6 100644 --- a/ip/iplink.c +++ b/ip/iplink.c @@ -482,7 +482,7 @@ static int iplink_modify(int cmd, unsigned int flags, int argc, char **argv) req.i.ifi_index = 0; addattr32(&req.n, sizeof(req), IFLA_GROUP, group); - if (rtnl_talk(&rth, &req.n, 0, 0, NULL, NULL, NULL) < 0) + if (rtnl_talk(&rth, &req.n, 0, 0, NULL) < 0) exit(2); return 0; } @@ -559,7 +559,7 @@ static int iplink_modify(int cmd, unsigned int flags, int argc, char **argv) addattr_l(&req.n, sizeof(req), IFLA_IFNAME, name, len); } - if (rtnl_talk(&rth, &req.n, 0, 0, NULL, NULL, NULL) < 0) + if (rtnl_talk(&rth, &req.n, 0, 0, NULL) < 0) exit(2); return 0; diff --git a/ip/ipneigh.c b/ip/ipneigh.c index dff9eb4..c8f745e 100644 --- a/ip/ipneigh.c +++ b/ip/ipneigh.c @@ -174,7 +174,7 @@ static int ipneigh_modify(int cmd, int flags, int argc, char **argv) return -1; } - if (rtnl_talk(&rth, &req.n, 0, 0, NULL, NULL, NULL) < 0) + if (rtnl_talk(&rth, &req.n, 0, 0, NULL) < 0) exit(2); return 0; @@ -391,7 +391,7 @@ int do_show_or_flush(int argc, char **argv, int flush) exit(1); } filter.flushed = 0; - if (rtnl_dump_filter(&rth, print_neigh, stdout, NULL, NULL) < 0) { + if (rtnl_dump_filter(&rth, print_neigh, stdout) < 0) { fprintf(stderr, "Flush terminated\n"); exit(1); } @@ -423,7 +423,7 @@ int do_show_or_flush(int argc, char **argv, int flush) exit(1); } - if (rtnl_dump_filter(&rth, print_neigh, stdout, NULL, NULL) < 0) { + if (rtnl_dump_filter(&rth, print_neigh, stdout) < 0) { fprintf(stderr, "Dump terminated\n"); exit(1); } diff --git a/ip/ipntable.c b/ip/ipntable.c index 141ad42..b00d3dc 100644 --- a/ip/ipntable.c +++ b/ip/ipntable.c @@ -313,7 +313,7 @@ static int ipntable_modify(int cmd, int flags, int argc, char **argv) RTA_PAYLOAD(parms_rta)); } - if (rtnl_talk(&rth, &req.n, 0, 0, NULL, NULL, NULL) < 0) + if (rtnl_talk(&rth, &req.n, 0, 0, NULL) < 0) exit(2); return 0; @@ -625,7 +625,7 @@ static int ipntable_show(int argc, char **argv) exit(1); } - if (rtnl_dump_filter(&rth, print_ntable, stdout, NULL, NULL) < 0) { + if (rtnl_dump_filter(&rth, print_ntable, stdout) < 0) { fprintf(stderr, "Dump terminated\n"); exit(1); } diff --git a/ip/iproute.c b/ip/iproute.c index 15b36e8..c97f979 100644 --- a/ip/iproute.c +++ b/ip/iproute.c @@ -1011,7 +1011,7 @@ int iproute_modify(int cmd, unsigned flags, int argc, char **argv) if (req.r.rtm_family == AF_UNSPEC) req.r.rtm_family = AF_INET; - if (rtnl_talk(&rth, &req.n, 0, 0, NULL, NULL, NULL) < 0) + if (rtnl_talk(&rth, &req.n, 0, 0, NULL) < 0) exit(2); return 0; @@ -1289,7 +1289,7 @@ static int iproute_list_flush_or_save(int argc, char **argv, int action) exit(1); } filter.flushed = 0; - if (rtnl_dump_filter(&rth, filter_fn, stdout, NULL, NULL) < 0) { + if (rtnl_dump_filter(&rth, filter_fn, stdout) < 0) { fprintf(stderr, "Flush terminated\n"); exit(1); } @@ -1332,7 +1332,7 @@ static int iproute_list_flush_or_save(int argc, char **argv, int action) } } - if (rtnl_dump_filter(&rth, filter_fn, stdout, NULL, NULL) < 0) { + if (rtnl_dump_filter(&rth, filter_fn, stdout) < 0) { fprintf(stderr, "Dump terminated\n"); exit(1); } @@ -1453,7 +1453,7 @@ int iproute_get(int argc, char **argv) if (req.r.rtm_family == AF_UNSPEC) req.r.rtm_family = AF_INET; - if (rtnl_talk(&rth, &req.n, 0, 0, &req.n, NULL, NULL) < 0) + if (rtnl_talk(&rth, &req.n, 0, 0, &req.n) < 0) exit(2); if (connected && !from_ok) { @@ -1494,7 +1494,7 @@ int iproute_get(int argc, char **argv) req.n.nlmsg_flags = NLM_F_REQUEST; req.n.nlmsg_type = RTM_GETROUTE; - if (rtnl_talk(&rth, &req.n, 0, 0, &req.n, NULL, NULL) < 0) + if (rtnl_talk(&rth, &req.n, 0, 0, &req.n) < 0) exit(2); } @@ -1514,7 +1514,7 @@ int restore_handler(const struct sockaddr_nl *nl, struct nlmsghdr *n, void *arg) ll_init_map(&rth); - ret = rtnl_talk(&rth, n, 0, 0, n, NULL, NULL); + ret = rtnl_talk(&rth, n, 0, 0, n); if ((ret < 0) && (errno == EEXIST)) ret = 0; diff --git a/ip/iprule.c b/ip/iprule.c index 9318d8c..f983731 100644 --- a/ip/iprule.c +++ b/ip/iprule.c @@ -212,7 +212,7 @@ static int iprule_list(int argc, char **argv) return 1; } - if (rtnl_dump_filter(&rth, print_rule, stdout, NULL, NULL) < 0) { + if (rtnl_dump_filter(&rth, print_rule, stdout) < 0) { fprintf(stderr, "Dump terminated\n"); return 1; } @@ -355,7 +355,7 @@ static int iprule_modify(int cmd, int argc, char **argv) if (!table_ok && cmd == RTM_NEWRULE) req.r.rtm_table = RT_TABLE_MAIN; - if (rtnl_talk(&rth, &req.n, 0, 0, NULL, NULL, NULL) < 0) + if (rtnl_talk(&rth, &req.n, 0, 0, NULL) < 0) return 2; return 0; @@ -382,7 +382,7 @@ static int flush_rule(const struct sockaddr_nl *who, struct nlmsghdr *n, void *a if (rtnl_open(&rth2, 0) < 0) return -1; - if (rtnl_talk(&rth2, n, 0, 0, NULL, NULL, NULL) < 0) + if (rtnl_talk(&rth2, n, 0, 0, NULL) < 0) return -2; rtnl_close(&rth2); @@ -408,7 +408,7 @@ static int iprule_flush(int argc, char **argv) return 1; } - if (rtnl_dump_filter(&rth, flush_rule, NULL, NULL, NULL) < 0) { + if (rtnl_dump_filter(&rth, flush_rule, NULL) < 0) { fprintf(stderr, "Flush terminated\n"); return 1; } diff --git a/ip/link_gre.c b/ip/link_gre.c index 62baaf4..c783203 100644 --- a/ip/link_gre.c +++ b/ip/link_gre.c @@ -72,7 +72,7 @@ static int gre_parse_opt(struct link_util *lu, int argc, char **argv, req.i.ifi_family = preferred_family; req.i.ifi_index = ifi->ifi_index; - if (rtnl_talk(&rth, &req.n, 0, 0, &req.n, NULL, NULL) < 0) { + if (rtnl_talk(&rth, &req.n, 0, 0, &req.n) < 0) { get_failed: fprintf(stderr, "Failed to get existing tunnel info.\n"); diff --git a/ip/rtmon.c b/ip/rtmon.c index 7869b32..c1416a0 100644 --- a/ip/rtmon.c +++ b/ip/rtmon.c @@ -163,7 +163,7 @@ main(int argc, char **argv) write_stamp(fp); - if (rtnl_dump_filter(&rth, dump_msg, fp, NULL, NULL) < 0) { + if (rtnl_dump_filter(&rth, dump_msg, fp) < 0) { fprintf(stderr, "Dump terminated\n"); return 1; } diff --git a/ip/xfrm_policy.c b/ip/xfrm_policy.c index 2a14903..8e3aec5 100644 --- a/ip/xfrm_policy.c +++ b/ip/xfrm_policy.c @@ -393,7 +393,7 @@ static int xfrm_policy_modify(int cmd, unsigned flags, int argc, char **argv) if (req.xpinfo.sel.family == AF_UNSPEC) req.xpinfo.sel.family = AF_INET; - if (rtnl_talk(&rth, &req.n, 0, 0, NULL, NULL, NULL) < 0) + if (rtnl_talk(&rth, &req.n, 0, 0, NULL) < 0) exit(2); rtnl_close(&rth); @@ -670,7 +670,7 @@ static int xfrm_policy_get_or_delete(int argc, char **argv, int delete, (void *)&ctx, ctx.sctx.len); } - if (rtnl_talk(&rth, &req.n, 0, 0, res_nlbuf, NULL, NULL) < 0) + if (rtnl_talk(&rth, &req.n, 0, 0, res_nlbuf) < 0) exit(2); rtnl_close(&rth); @@ -859,7 +859,7 @@ static int xfrm_policy_list_or_deleteall(int argc, char **argv, int deleteall) exit(1); } - if (rtnl_dump_filter(&rth, xfrm_policy_keep, &xb, NULL, NULL) < 0) { + if (rtnl_dump_filter(&rth, xfrm_policy_keep, &xb) < 0) { fprintf(stderr, "Delete-all terminated\n"); exit(1); } @@ -885,7 +885,7 @@ static int xfrm_policy_list_or_deleteall(int argc, char **argv, int deleteall) exit(1); } - if (rtnl_dump_filter(&rth, xfrm_policy_print, stdout, NULL, NULL) < 0) { + if (rtnl_dump_filter(&rth, xfrm_policy_print, stdout) < 0) { fprintf(stderr, "Dump terminated\n"); exit(1); } @@ -975,7 +975,7 @@ static int xfrm_spd_getinfo(int argc, char **argv) if (rtnl_open_byproto(&rth, 0, NETLINK_XFRM) < 0) exit(1); - if (rtnl_talk(&rth, &req.n, 0, 0, &req.n, NULL, NULL) < 0) + if (rtnl_talk(&rth, &req.n, 0, 0, &req.n) < 0) exit(2); print_spdinfo(&req.n, (void*)stdout); @@ -1027,7 +1027,7 @@ static int xfrm_policy_flush(int argc, char **argv) if (show_stats > 1) fprintf(stderr, "Flush policy\n"); - if (rtnl_talk(&rth, &req.n, 0, 0, NULL, NULL, NULL) < 0) + if (rtnl_talk(&rth, &req.n, 0, 0, NULL) < 0) exit(2); rtnl_close(&rth); diff --git a/ip/xfrm_state.c b/ip/xfrm_state.c index a76be47..0d98e78 100644 --- a/ip/xfrm_state.c +++ b/ip/xfrm_state.c @@ -544,7 +544,7 @@ static int xfrm_state_modify(int cmd, unsigned flags, int argc, char **argv) if (req.xsinfo.family == AF_UNSPEC) req.xsinfo.family = AF_INET; - if (rtnl_talk(&rth, &req.n, 0, 0, NULL, NULL, NULL) < 0) + if (rtnl_talk(&rth, &req.n, 0, 0, NULL) < 0) exit(2); rtnl_close(&rth); @@ -681,7 +681,7 @@ static int xfrm_state_allocspi(int argc, char **argv) req.xspi.info.family = AF_INET; - if (rtnl_talk(&rth, &req.n, 0, 0, res_n, NULL, NULL) < 0) + if (rtnl_talk(&rth, &req.n, 0, 0, res_n) < 0) exit(2); if (xfrm_state_print(NULL, res_n, (void*)stdout) < 0) { @@ -871,7 +871,7 @@ static int xfrm_state_get_or_delete(int argc, char **argv, int delete) req.xsid.family = AF_INET; if (delete) { - if (rtnl_talk(&rth, &req.n, 0, 0, NULL, NULL, NULL) < 0) + if (rtnl_talk(&rth, &req.n, 0, 0, NULL) < 0) exit(2); } else { char buf[NLMSG_BUF_SIZE]; @@ -879,7 +879,7 @@ static int xfrm_state_get_or_delete(int argc, char **argv, int delete) memset(buf, 0, sizeof(buf)); - if (rtnl_talk(&rth, &req.n, 0, 0, res_n, NULL, NULL) < 0) + if (rtnl_talk(&rth, &req.n, 0, 0, res_n) < 0) exit(2); if (xfrm_state_print(NULL, res_n, (void*)stdout) < 0) { @@ -1015,7 +1015,7 @@ static int xfrm_state_list_or_deleteall(int argc, char **argv, int deleteall) exit(1); } - if (rtnl_dump_filter(&rth, xfrm_state_keep, &xb, NULL, NULL) < 0) { + if (rtnl_dump_filter(&rth, xfrm_state_keep, &xb) < 0) { fprintf(stderr, "Delete-all terminated\n"); exit(1); } @@ -1042,7 +1042,7 @@ static int xfrm_state_list_or_deleteall(int argc, char **argv, int deleteall) exit(1); } - if (rtnl_dump_filter(&rth, xfrm_state_print, stdout, NULL, NULL) < 0) { + if (rtnl_dump_filter(&rth, xfrm_state_print, stdout) < 0) { fprintf(stderr, "Dump terminated\n"); exit(1); } @@ -1120,7 +1120,7 @@ static int xfrm_sad_getinfo(int argc, char **argv) if (rtnl_open_byproto(&rth, 0, NETLINK_XFRM) < 0) exit(1); - if (rtnl_talk(&rth, &req.n, 0, 0, &req.n, NULL, NULL) < 0) + if (rtnl_talk(&rth, &req.n, 0, 0, &req.n) < 0) exit(2); print_sadinfo(&req.n, (void*)stdout); @@ -1174,7 +1174,7 @@ static int xfrm_state_flush(int argc, char **argv) fprintf(stderr, "Flush state proto=%s\n", strxf_xfrmproto(req.xsf.proto)); - if (rtnl_talk(&rth, &req.n, 0, 0, NULL, NULL, NULL) < 0) + if (rtnl_talk(&rth, &req.n, 0, 0, NULL) < 0) exit(2); rtnl_close(&rth); diff --git a/lib/libnetlink.c b/lib/libnetlink.c index f7413b6..c8fc4ef 100644 --- a/lib/libnetlink.c +++ b/lib/libnetlink.c @@ -214,15 +214,8 @@ int rtnl_dump_filter_l(struct rtnl_handle *rth, if (nladdr.nl_pid != 0 || h->nlmsg_pid != rth->local.nl_pid || - h->nlmsg_seq != rth->dump) { - if (a->junk) { - err = a->junk(&nladdr, h, - a->arg2); - if (err < 0) - return err; - } + h->nlmsg_seq != rth->dump) goto skip_it; - } if (h->nlmsg_type == NLMSG_DONE) { found_done = 1; @@ -264,22 +257,18 @@ skip_it: int rtnl_dump_filter(struct rtnl_handle *rth, rtnl_filter_t filter, - void *arg1, - rtnl_filter_t junk, - void *arg2) + void *arg1) { const struct rtnl_dump_filter_arg a[2] = { - { .filter = filter, .arg1 = arg1, .junk = junk, .arg2 = arg2 }, - { .filter = NULL, .arg1 = NULL, .junk = NULL, .arg2 = NULL } + { .filter = filter, .arg1 = arg1, }, + { .filter = NULL, .arg1 = NULL, }, }; return rtnl_dump_filter_l(rth, a); } int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, pid_t peer, - unsigned groups, struct nlmsghdr *answer, - rtnl_filter_t junk, - void *jarg) + unsigned groups, struct nlmsghdr *answer) { int status; unsigned seq; @@ -338,11 +327,10 @@ int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, pid_t peer, exit(1); } for (h = (struct nlmsghdr*)buf; status >= sizeof(*h); ) { - int err; int len = h->nlmsg_len; int l = len - sizeof(*h); - if (l<0 || len>status) { + if (l < 0 || len>status) { if (msg.msg_flags & MSG_TRUNC) { fprintf(stderr, "Truncated message\n"); return -1; @@ -354,11 +342,6 @@ int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, pid_t peer, if (nladdr.nl_pid != peer || h->nlmsg_pid != rtnl->local.nl_pid || h->nlmsg_seq != seq) { - if (junk) { - err = junk(&nladdr, h, jarg); - if (err < 0) - return err; - } /* Don't forget to skip that message. */ status -= NLMSG_ALIGN(len); h = (struct nlmsghdr*)((char*)h + NLMSG_ALIGN(len)); diff --git a/lib/ll_map.c b/lib/ll_map.c index d3cde22..1ca781e 100644 --- a/lib/ll_map.c +++ b/lib/ll_map.c @@ -204,7 +204,7 @@ int ll_init_map(struct rtnl_handle *rth) exit(1); } - if (rtnl_dump_filter(rth, ll_remember_index, NULL, NULL, NULL) < 0) { + if (rtnl_dump_filter(rth, ll_remember_index, NULL) < 0) { fprintf(stderr, "Dump terminated\n"); exit(1); } diff --git a/misc/ifstat.c b/misc/ifstat.c index 7d33f5e..e7fbaa8 100644 --- a/misc/ifstat.c +++ b/misc/ifstat.c @@ -128,7 +128,7 @@ void load_info(void) exit(1); } - if (rtnl_dump_filter(&rth, get_nlmsg, NULL, NULL, NULL) < 0) { + if (rtnl_dump_filter(&rth, get_nlmsg, NULL) < 0) { fprintf(stderr, "Dump terminated\n"); exit(1); } diff --git a/tc/m_action.c b/tc/m_action.c index 6464b2e..1fe2431 100644 --- a/tc/m_action.c +++ b/tc/m_action.c @@ -451,7 +451,7 @@ int tc_action_gd(int cmd, unsigned flags, int *argc_p, char ***argv_p) if (cmd == RTM_GETACTION) ans = &req.n; - if (rtnl_talk(&rth, &req.n, 0, 0, ans, NULL, NULL) < 0) { + if (rtnl_talk(&rth, &req.n, 0, 0, ans) < 0) { fprintf(stderr, "We have an error talking to the kernel\n"); return 1; } @@ -496,7 +496,7 @@ int tc_action_modify(int cmd, unsigned flags, int *argc_p, char ***argv_p) } tail->rta_len = (void *) NLMSG_TAIL(&req.n) - (void *) tail; - if (rtnl_talk(&rth, &req.n, 0, 0, NULL, NULL, NULL) < 0) { + if (rtnl_talk(&rth, &req.n, 0, 0, NULL) < 0) { fprintf(stderr, "We have an error talking to the kernel\n"); ret = -1; } @@ -558,7 +558,7 @@ int tc_act_list_or_flush(int argc, char **argv, int event) perror("Cannot send dump request"); return 1; } - ret = rtnl_dump_filter(&rth, print_action, stdout, NULL, NULL); + ret = rtnl_dump_filter(&rth, print_action, stdout); } if (event == RTM_DELACTION) { @@ -566,7 +566,7 @@ int tc_act_list_or_flush(int argc, char **argv, int event) req.n.nlmsg_type = RTM_DELACTION; req.n.nlmsg_flags |= NLM_F_ROOT; req.n.nlmsg_flags |= NLM_F_REQUEST; - if (rtnl_talk(&rth, &req.n, 0, 0, NULL, NULL, NULL) < 0) { + if (rtnl_talk(&rth, &req.n, 0, 0, NULL) < 0) { fprintf(stderr, "We have an error flushing\n"); return 1; } diff --git a/tc/tc_class.c b/tc/tc_class.c index 9d4eea5..3a1a0ac 100644 --- a/tc/tc_class.c +++ b/tc/tc_class.c @@ -138,7 +138,7 @@ int tc_class_modify(int cmd, unsigned flags, int argc, char **argv) } } - if (rtnl_talk(&rth, &req.n, 0, 0, NULL, NULL, NULL) < 0) + if (rtnl_talk(&rth, &req.n, 0, 0, NULL) < 0) return 2; return 0; @@ -298,7 +298,7 @@ int tc_class_list(int argc, char **argv) return 1; } - if (rtnl_dump_filter(&rth, print_class, stdout, NULL, NULL) < 0) { + if (rtnl_dump_filter(&rth, print_class, stdout) < 0) { fprintf(stderr, "Dump terminated\n"); return 1; } diff --git a/tc/tc_filter.c b/tc/tc_filter.c index 4e55812..d4b0b67 100644 --- a/tc/tc_filter.c +++ b/tc/tc_filter.c @@ -167,7 +167,7 @@ int tc_filter_modify(int cmd, unsigned flags, int argc, char **argv) } } - if (rtnl_talk(&rth, &req.n, 0, 0, NULL, NULL, NULL) < 0) { + if (rtnl_talk(&rth, &req.n, 0, 0, NULL) < 0) { fprintf(stderr, "We have an error talking to the kernel\n"); return 2; } @@ -341,7 +341,7 @@ int tc_filter_list(int argc, char **argv) return 1; } - if (rtnl_dump_filter(&rth, print_filter, stdout, NULL, NULL) < 0) { + if (rtnl_dump_filter(&rth, print_filter, stdout) < 0) { fprintf(stderr, "Dump terminated\n"); return 1; } diff --git a/tc/tc_qdisc.c b/tc/tc_qdisc.c index c7f2988..0822e63 100644 --- a/tc/tc_qdisc.c +++ b/tc/tc_qdisc.c @@ -186,7 +186,7 @@ int tc_qdisc_modify(int cmd, unsigned flags, int argc, char **argv) req.t.tcm_ifindex = idx; } - if (rtnl_talk(&rth, &req.n, 0, 0, NULL, NULL, NULL) < 0) + if (rtnl_talk(&rth, &req.n, 0, 0, NULL) < 0) return 2; return 0; @@ -323,7 +323,7 @@ int tc_qdisc_list(int argc, char **argv) return 1; } - if (rtnl_dump_filter(&rth, print_qdisc, stdout, NULL, NULL) < 0) { + if (rtnl_dump_filter(&rth, print_qdisc, stdout) < 0) { fprintf(stderr, "Dump terminated\n"); return 1; } -- 2.39.2