From: David Ahern <dsah...@gmail.com> No command, filter, or print function uses the sockaddr_nl arg, so just drop it.
Signed-off-by: David Ahern <dsah...@gmail.com> --- bridge/br_common.h | 9 +++------ bridge/fdb.c | 2 +- bridge/link.c | 3 +-- bridge/mdb.c | 2 +- bridge/monitor.c | 9 ++++----- bridge/vlan.c | 12 +++--------- genl/ctrl.c | 10 ++++------ genl/genl.c | 3 +-- genl/genl_utils.h | 3 +-- include/libnetlink.h | 6 ++---- include/ll_map.h | 3 +-- ip/ip_common.h | 36 ++++++++++++------------------------ ip/ipaddress.c | 26 ++++++++++---------------- ip/ipaddrlabel.c | 4 ++-- ip/ipfou.c | 3 +-- ip/ipila.c | 3 +-- ip/ipl2tp.c | 6 ++---- ip/iplink.c | 9 +++------ ip/iplink_bridge.c | 3 +-- ip/ipmacsec.c | 3 +-- ip/ipmonitor.c | 25 ++++++++++++------------- ip/ipmroute.c | 2 +- ip/ipneigh.c | 2 +- ip/ipnetconf.c | 8 +++----- ip/ipnetns.c | 5 ++--- ip/ipntable.c | 3 +-- ip/ipprefix.c | 2 +- ip/iproute.c | 17 +++++++---------- ip/iprule.c | 11 ++++------- ip/ipseg6.c | 5 ++--- ip/iptoken.c | 2 +- ip/iptuntap.c | 3 +-- ip/rtmon.c | 7 +++---- ip/tcp_metrics.c | 5 ++--- ip/tunnel.c | 3 +-- ip/xfrm.h | 6 ++---- ip/xfrm_monitor.c | 37 +++++++++++++++---------------------- ip/xfrm_policy.c | 9 +++------ ip/xfrm_state.c | 11 ++++------- lib/libnetlink.c | 7 +++---- lib/ll_map.c | 3 +-- misc/ifstat.c | 6 ++---- misc/ss.c | 31 ++++++++++++------------------- tc/m_action.c | 6 ++---- tc/tc_class.c | 3 +-- tc/tc_common.h | 8 ++++---- tc/tc_filter.c | 4 ++-- tc/tc_monitor.c | 11 +++++------ tc/tc_qdisc.c | 6 ++---- 49 files changed, 155 insertions(+), 248 deletions(-) diff --git a/bridge/br_common.h b/bridge/br_common.h index 00a4e9ea125d..23d653df931d 100644 --- a/bridge/br_common.h +++ b/bridge/br_common.h @@ -7,12 +7,9 @@ ((struct rtattr *)(((char *)(r)) + RTA_ALIGN(sizeof(__u32)))) void print_vlan_info(struct rtattr *tb, int ifindex); -int print_linkinfo(const struct sockaddr_nl *who, - struct nlmsghdr *n, void *arg); -int print_fdb(const struct sockaddr_nl *who, - struct nlmsghdr *n, void *arg); -int print_mdb(const struct sockaddr_nl *who, - struct nlmsghdr *n, void *arg); +int print_linkinfo(struct nlmsghdr *n, void *arg); +int print_fdb(struct nlmsghdr *n, void *arg); +int print_mdb(struct nlmsghdr *n, void *arg); int do_fdb(int argc, char **argv); int do_mdb(int argc, char **argv); diff --git a/bridge/fdb.c b/bridge/fdb.c index 828fdab264cb..d759f7ec12e2 100644 --- a/bridge/fdb.c +++ b/bridge/fdb.c @@ -126,7 +126,7 @@ static void fdb_print_stats(FILE *fp, const struct nda_cacheinfo *ci) } } -int print_fdb(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) +int print_fdb(struct nlmsghdr *n, void *arg) { FILE *fp = arg; struct ndmsg *r = NLMSG_DATA(n); diff --git a/bridge/link.c b/bridge/link.c index 4a14845da591..3290c16f0951 100644 --- a/bridge/link.c +++ b/bridge/link.c @@ -190,8 +190,7 @@ static void print_af_spec(struct rtattr *attr, int ifindex) print_vlan_info(aftb[IFLA_BRIDGE_VLAN_INFO], ifindex); } -int print_linkinfo(const struct sockaddr_nl *who, - struct nlmsghdr *n, void *arg) +int print_linkinfo(struct nlmsghdr *n, void *arg) { FILE *fp = arg; struct ifinfomsg *ifi = NLMSG_DATA(n); diff --git a/bridge/mdb.c b/bridge/mdb.c index 03fcc91f0219..855a6a4552c7 100644 --- a/bridge/mdb.c +++ b/bridge/mdb.c @@ -225,7 +225,7 @@ static void print_router_entries(FILE *fp, struct nlmsghdr *n, close_json_array(PRINT_JSON, NULL); } -int print_mdb(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) +int print_mdb(struct nlmsghdr *n, void *arg) { FILE *fp = arg; struct br_port_msg *r = NLMSG_DATA(n); diff --git a/bridge/monitor.c b/bridge/monitor.c index d294269e1092..82bc6b407a06 100644 --- a/bridge/monitor.c +++ b/bridge/monitor.c @@ -35,8 +35,7 @@ static void usage(void) exit(-1); } -static int accept_msg(const struct sockaddr_nl *who, - struct rtnl_ctrl_data *ctrl, +static int accept_msg(struct rtnl_ctrl_data *ctrl, struct nlmsghdr *n, void *arg) { FILE *fp = arg; @@ -50,19 +49,19 @@ static int accept_msg(const struct sockaddr_nl *who, if (prefix_banner) fprintf(fp, "[LINK]"); - return print_linkinfo(who, n, arg); + return print_linkinfo(n, arg); case RTM_NEWNEIGH: case RTM_DELNEIGH: if (prefix_banner) fprintf(fp, "[NEIGH]"); - return print_fdb(who, n, arg); + return print_fdb(n, arg); case RTM_NEWMDB: case RTM_DELMDB: if (prefix_banner) fprintf(fp, "[MDB]"); - return print_mdb(who, n, arg); + return print_mdb(n, arg); case NLMSG_TSTAMP: print_nlmsg_timestamp(fp, n); diff --git a/bridge/vlan.c b/bridge/vlan.c index 239907bdad89..a111d5e66439 100644 --- a/bridge/vlan.c +++ b/bridge/vlan.c @@ -347,9 +347,7 @@ static void print_vlan_tunnel_info(FILE *fp, struct rtattr *tb, int ifindex) close_vlan_port(); } -static int print_vlan_tunnel(const struct sockaddr_nl *who, - struct nlmsghdr *n, - void *arg) +static int print_vlan_tunnel(struct nlmsghdr *n, void *arg) { struct ifinfomsg *ifm = NLMSG_DATA(n); struct rtattr *tb[IFLA_MAX+1]; @@ -392,9 +390,7 @@ static int print_vlan_tunnel(const struct sockaddr_nl *who, return 0; } -static int print_vlan(const struct sockaddr_nl *who, - struct nlmsghdr *n, - void *arg) +static int print_vlan(struct nlmsghdr *n, void *arg) { FILE *fp = arg; struct ifinfomsg *ifm = NLMSG_DATA(n); @@ -513,9 +509,7 @@ static void print_vlan_stats_attr(struct rtattr *attr, int ifindex) } -static int print_vlan_stats(const struct sockaddr_nl *who, - struct nlmsghdr *n, - void *arg) +static int print_vlan_stats(struct nlmsghdr *n, void *arg) { struct if_stats_msg *ifsm = NLMSG_DATA(n); struct rtattr *tb[IFLA_STATS_MAX+1]; diff --git a/genl/ctrl.c b/genl/ctrl.c index 0d9c5f2517b7..6133336ab435 100644 --- a/genl/ctrl.c +++ b/genl/ctrl.c @@ -174,8 +174,7 @@ static int print_ctrl_grp(FILE *fp, struct rtattr *arg, __u32 ctrl_ver) /* * The controller sends one nlmsg per family */ -static int print_ctrl(const struct sockaddr_nl *who, - struct rtnl_ctrl_data *ctrl, +static int print_ctrl(struct rtnl_ctrl_data *ctrl, struct nlmsghdr *n, void *arg) { struct rtattr *tb[CTRL_ATTR_MAX + 1]; @@ -279,10 +278,9 @@ static int print_ctrl(const struct sockaddr_nl *who, return 0; } -static int print_ctrl2(const struct sockaddr_nl *who, - struct nlmsghdr *n, void *arg) +static int print_ctrl2(struct nlmsghdr *n, void *arg) { - return print_ctrl(who, NULL, n, arg); + return print_ctrl(NULL, n, arg); } static int ctrl_list(int cmd, int argc, char **argv) @@ -339,7 +337,7 @@ static int ctrl_list(int cmd, int argc, char **argv) goto ctrl_done; } - if (print_ctrl2(NULL, answer, (void *) stdout) < 0) { + if (print_ctrl2(answer, (void *) stdout) < 0) { fprintf(stderr, "Dump terminated\n"); goto ctrl_done; } diff --git a/genl/genl.c b/genl/genl.c index 253c4450a3b9..aba3c13afd34 100644 --- a/genl/genl.c +++ b/genl/genl.c @@ -34,8 +34,7 @@ static void *BODY; static struct genl_util *genl_list; -static int print_nofopt(const struct sockaddr_nl *who, struct nlmsghdr *n, - void *arg) +static int print_nofopt(struct nlmsghdr *n, void *arg) { fprintf((FILE *) arg, "unknown genl type ..\n"); return 0; diff --git a/genl/genl_utils.h b/genl/genl_utils.h index 3de0da34bdba..cc1f3fb76596 100644 --- a/genl/genl_utils.h +++ b/genl/genl_utils.h @@ -10,8 +10,7 @@ struct genl_util struct genl_util *next; char name[16]; int (*parse_genlopt)(struct genl_util *fu, int argc, char **argv); - int (*print_genlopt)(const struct sockaddr_nl *who, - struct nlmsghdr *n, void *arg); + int (*print_genlopt)(struct nlmsghdr *n, void *arg); }; int genl_ctrl_resolve_family(const char *family); diff --git a/include/libnetlink.h b/include/libnetlink.h index 04264b871ce4..fa8de093d484 100644 --- a/include/libnetlink.h +++ b/include/libnetlink.h @@ -88,11 +88,9 @@ struct rtnl_ctrl_data { int nsid; }; -typedef int (*rtnl_filter_t)(const struct sockaddr_nl *, - struct nlmsghdr *n, void *); +typedef int (*rtnl_filter_t)(struct nlmsghdr *n, void *); -typedef int (*rtnl_listen_filter_t)(const struct sockaddr_nl *, - struct rtnl_ctrl_data *, +typedef int (*rtnl_listen_filter_t)(struct rtnl_ctrl_data *, struct nlmsghdr *n, void *); typedef int (*nl_ext_ack_fn_t)(const char *errmsg, uint32_t off, diff --git a/include/ll_map.h b/include/ll_map.h index 8546ff928bc0..fb708191c22c 100644 --- a/include/ll_map.h +++ b/include/ll_map.h @@ -2,8 +2,7 @@ #ifndef __LL_MAP_H__ #define __LL_MAP_H__ 1 -int ll_remember_index(const struct sockaddr_nl *who, - struct nlmsghdr *n, void *arg); +int ll_remember_index(struct nlmsghdr *n, void *arg); void ll_init_map(struct rtnl_handle *rth); unsigned ll_name_to_index(const char *name); diff --git a/ip/ip_common.h b/ip/ip_common.h index 458a9cb7ff2c..53668f598cd2 100644 --- a/ip/ip_common.h +++ b/ip/ip_common.h @@ -27,14 +27,10 @@ struct link_filter { }; int get_operstate(const char *name); -int print_linkinfo(const struct sockaddr_nl *who, - struct nlmsghdr *n, void *arg); -int print_addrinfo(const struct sockaddr_nl *who, - struct nlmsghdr *n, void *arg); -int print_addrlabel(const struct sockaddr_nl *who, - struct nlmsghdr *n, void *arg); -int print_neigh(const struct sockaddr_nl *who, - struct nlmsghdr *n, void *arg); +int print_linkinfo(struct nlmsghdr *n, void *arg); +int print_addrinfo(struct nlmsghdr *n, void *arg); +int print_addrlabel(struct nlmsghdr *n, void *arg); +int print_neigh(struct nlmsghdr *n, void *arg); int ipaddr_list_link(int argc, char **argv); void ipaddr_get_vf_rate(int, int *, int *, const char *); void iplink_usage(void) __attribute__((noreturn)); @@ -45,21 +41,15 @@ void ipaddr_reset_filter(int oneline, int ifindex); void ipneigh_reset_filter(int ifindex); void ipnetconf_reset_filter(int ifindex); -int print_route(const struct sockaddr_nl *who, - struct nlmsghdr *n, void *arg); -int print_mroute(const struct sockaddr_nl *who, - struct nlmsghdr *n, void *arg); -int print_prefix(const struct sockaddr_nl *who, - struct nlmsghdr *n, void *arg); -int print_rule(const struct sockaddr_nl *who, - struct nlmsghdr *n, void *arg); -int print_netconf(const struct sockaddr_nl *who, - struct rtnl_ctrl_data *ctrl, +int print_route(struct nlmsghdr *n, void *arg); +int print_mroute(struct nlmsghdr *n, void *arg); +int print_prefix(struct nlmsghdr *n, void *arg); +int print_rule(struct nlmsghdr *n, void *arg); +int print_netconf(struct rtnl_ctrl_data *ctrl, struct nlmsghdr *n, void *arg); void netns_map_init(void); void netns_nsid_socket_init(void); -int print_nsid(const struct sockaddr_nl *who, - struct nlmsghdr *n, void *arg); +int print_nsid(struct nlmsghdr *n, void *arg); char *get_name_from_nsid(int nsid); int get_netnsid_from_name(const char *name); int set_netnsid_from_name(const char *name, int nsid); @@ -129,8 +119,7 @@ struct link_util { FILE *); int (*parse_ifla_xstats)(struct link_util *, int, char **); - int (*print_ifla_xstats)(const struct sockaddr_nl *, - struct nlmsghdr *, void *); + int (*print_ifla_xstats)(struct nlmsghdr *, void *); }; struct link_util *get_link_kind(const char *kind); @@ -140,8 +129,7 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req, char **type); /* iplink_bridge.c */ void br_dump_bridge_id(const struct ifla_bridge_id *id, char *buf, size_t len); int bridge_parse_xstats(struct link_util *lu, int argc, char **argv); -int bridge_print_xstats(const struct sockaddr_nl *who, - struct nlmsghdr *n, void *arg); +int bridge_print_xstats(struct nlmsghdr *n, void *arg); /* iproute_lwtunnel.c */ int lwt_parse_encap(struct rtattr *rta, size_t len, int *argcp, char ***argvp); diff --git a/ip/ipaddress.c b/ip/ipaddress.c index 9481f241cb36..cd8cc76a3473 100644 --- a/ip/ipaddress.c +++ b/ip/ipaddress.c @@ -824,8 +824,7 @@ static void print_link_event(FILE *f, __u32 event) } } -int print_linkinfo(const struct sockaddr_nl *who, - struct nlmsghdr *n, void *arg) +int print_linkinfo(struct nlmsghdr *n, void *arg) { FILE *fp = (FILE *)arg; struct ifinfomsg *ifi = NLMSG_DATA(n); @@ -1261,8 +1260,7 @@ static int ifa_label_match_rta(int ifindex, const struct rtattr *rta) return fnmatch(filter.label, label, 0); } -int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n, - void *arg) +int print_addrinfo(struct nlmsghdr *n, void *arg) { FILE *fp = arg; struct ifaddrmsg *ifa = NLMSG_DATA(n); @@ -1478,7 +1476,7 @@ static int print_selected_addrinfo(struct ifinfomsg *ifi, continue; open_json_object(NULL); - print_addrinfo(NULL, n, fp); + print_addrinfo(n, fp); close_json_object(); } close_json_array(PRINT_JSON, NULL); @@ -1491,8 +1489,7 @@ static int print_selected_addrinfo(struct ifinfomsg *ifi, } -static int store_nlmsg(const struct sockaddr_nl *who, struct nlmsghdr *n, - void *arg) +static int store_nlmsg(struct nlmsghdr *n, void *arg) { struct nlmsg_chain *lchain = (struct nlmsg_chain *)arg; struct nlmsg_list *h; @@ -1510,7 +1507,7 @@ static int store_nlmsg(const struct sockaddr_nl *who, struct nlmsghdr *n, lchain->head = h; lchain->tail = h; - ll_remember_index(who, n, NULL); + ll_remember_index(n, NULL); return 0; } @@ -1553,8 +1550,7 @@ static int ipadd_dump_check_magic(void) return 0; } -static int save_nlmsg(const struct sockaddr_nl *who, struct nlmsghdr *n, - void *arg) +static int save_nlmsg(struct nlmsghdr *n, void *arg) { int ret; @@ -1567,15 +1563,14 @@ static int save_nlmsg(const struct sockaddr_nl *who, struct nlmsghdr *n, return ret == n->nlmsg_len ? 0 : ret; } -static int show_handler(const struct sockaddr_nl *nl, - struct rtnl_ctrl_data *ctrl, +static int show_handler(struct rtnl_ctrl_data *ctrl, struct nlmsghdr *n, void *arg) { struct ifaddrmsg *ifa = NLMSG_DATA(n); open_json_object(NULL); print_int(PRINT_ANY, "index", "if%d:\n", ifa->ifa_index); - print_addrinfo(NULL, n, stdout); + print_addrinfo(n, stdout); close_json_object(); return 0; } @@ -1600,8 +1595,7 @@ static int ipaddr_showdump(void) exit(err); } -static int restore_handler(const struct sockaddr_nl *nl, - struct rtnl_ctrl_data *ctrl, +static int restore_handler(struct rtnl_ctrl_data *ctrl, struct nlmsghdr *n, void *arg) { int ret; @@ -1970,7 +1964,7 @@ static int ipaddr_list_flush_or_save(int argc, char **argv, int action) open_json_object(NULL); if (brief || !no_link) - res = print_linkinfo(NULL, n, stdout); + res = print_linkinfo(n, stdout); if (res >= 0 && filter.family != AF_PACKET) print_selected_addrinfo(ifi, ainfo->head, stdout); if (res > 0 && !do_link && show_stats) diff --git a/ip/ipaddrlabel.c b/ip/ipaddrlabel.c index 845fe4c5db27..3714e41785c0 100644 --- a/ip/ipaddrlabel.c +++ b/ip/ipaddrlabel.c @@ -54,7 +54,7 @@ static void usage(void) exit(-1); } -int print_addrlabel(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) +int print_addrlabel(struct nlmsghdr *n, void *arg) { struct ifaddrlblmsg *ifal = NLMSG_DATA(n); int len = n->nlmsg_len; @@ -196,7 +196,7 @@ static int ipaddrlabel_modify(int cmd, int argc, char **argv) } -static int flush_addrlabel(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) +static int flush_addrlabel(struct nlmsghdr *n, void *arg) { struct rtnl_handle rth2; struct rtmsg *r = NLMSG_DATA(n); diff --git a/ip/ipfou.c b/ip/ipfou.c index 0cb5e3c7a0c7..346522ddb7f7 100644 --- a/ip/ipfou.c +++ b/ip/ipfou.c @@ -137,8 +137,7 @@ static int do_del(int argc, char **argv) return 0; } -static int print_fou_mapping(const struct sockaddr_nl *who, - struct nlmsghdr *n, void *arg) +static int print_fou_mapping(struct nlmsghdr *n, void *arg) { struct genlmsghdr *ghdr; struct rtattr *tb[FOU_ATTR_MAX + 1]; diff --git a/ip/ipila.c b/ip/ipila.c index 895fe0cdaf77..11fbb5fae805 100644 --- a/ip/ipila.c +++ b/ip/ipila.c @@ -81,8 +81,7 @@ static void print_ila_locid(const char *tag, int attr, struct rtattr *tb[]) print_string(PRINT_ANY, tag, "%-20s", abuf); } -static int print_ila_mapping(const struct sockaddr_nl *who, - struct nlmsghdr *n, void *arg) +static int print_ila_mapping(struct nlmsghdr *n, void *arg) { struct genlmsghdr *ghdr; struct rtattr *tb[ILA_ATTR_MAX + 1]; diff --git a/ip/ipl2tp.c b/ip/ipl2tp.c index 16561eccd458..4308b5911965 100644 --- a/ip/ipl2tp.c +++ b/ip/ipl2tp.c @@ -437,8 +437,7 @@ static int get_response(struct nlmsghdr *n, void *arg) return 0; } -static int session_nlmsg(const struct sockaddr_nl *who, - struct nlmsghdr *n, void *arg) +static int session_nlmsg(struct nlmsghdr *n, void *arg) { int ret = get_response(n, arg); @@ -476,8 +475,7 @@ static int get_session(struct l2tp_data *p) return 0; } -static int tunnel_nlmsg(const struct sockaddr_nl *who, - struct nlmsghdr *n, void *arg) +static int tunnel_nlmsg(struct nlmsghdr *n, void *arg) { int ret = get_response(n, arg); diff --git a/ip/iplink.c b/ip/iplink.c index 9f39e3826c19..b5519201fef7 100644 --- a/ip/iplink.c +++ b/ip/iplink.c @@ -199,8 +199,7 @@ static int get_addr_gen_mode(const char *mode) #if IPLINK_IOCTL_COMPAT static int have_rtnl_newlink = -1; -static int accept_msg(const struct sockaddr_nl *who, - struct rtnl_ctrl_data *ctrl, +static int accept_msg(struct rtnl_ctrl_data *ctrl, struct nlmsghdr *n, void *arg) { struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(n); @@ -1107,7 +1106,7 @@ int iplink_get(char *name, __u32 filt_mask) return -2; open_json_object(NULL); - print_linkinfo(NULL, answer, stdout); + print_linkinfo(answer, stdout); close_json_object(); free(answer); @@ -1536,9 +1535,7 @@ struct af_stats_ctx { int ifindex; }; -static int print_af_stats(const struct sockaddr_nl *who, - struct nlmsghdr *n, - void *arg) +static int print_af_stats(struct nlmsghdr *n, void *arg) { struct if_stats_msg *ifsm = NLMSG_DATA(n); struct rtattr *tb[IFLA_STATS_MAX+1]; diff --git a/ip/iplink_bridge.c b/ip/iplink_bridge.c index 3008e44b7d72..0ba6be3f47da 100644 --- a/ip/iplink_bridge.c +++ b/ip/iplink_bridge.c @@ -757,8 +757,7 @@ static void bridge_print_stats_attr(FILE *f, struct rtattr *attr, int ifindex) } } -int bridge_print_xstats(const struct sockaddr_nl *who, - struct nlmsghdr *n, void *arg) +int bridge_print_xstats(struct nlmsghdr *n, void *arg) { struct if_stats_msg *ifsm = NLMSG_DATA(n); struct rtattr *tb[IFLA_STATS_MAX+1]; diff --git a/ip/ipmacsec.c b/ip/ipmacsec.c index fa56e0eee774..646bd891730f 100644 --- a/ip/ipmacsec.c +++ b/ip/ipmacsec.c @@ -929,8 +929,7 @@ static void print_rxsc_list(struct rtattr *sc) close_json_array(PRINT_JSON, NULL); } -static int process(const struct sockaddr_nl *who, struct nlmsghdr *n, - void *arg) +static int process(struct nlmsghdr *n, void *arg) { struct genlmsghdr *ghdr; struct rtattr *attrs[MACSEC_ATTR_MAX + 1]; diff --git a/ip/ipmonitor.c b/ip/ipmonitor.c index a93b62cd6624..9d5ac2b5e4d2 100644 --- a/ip/ipmonitor.c +++ b/ip/ipmonitor.c @@ -52,8 +52,7 @@ static void print_headers(FILE *fp, char *label, struct rtnl_ctrl_data *ctrl) fprintf(fp, "%s", label); } -static int accept_msg(const struct sockaddr_nl *who, - struct rtnl_ctrl_data *ctrl, +static int accept_msg(struct rtnl_ctrl_data *ctrl, struct nlmsghdr *n, void *arg) { FILE *fp = (FILE *)arg; @@ -75,32 +74,32 @@ static int accept_msg(const struct sockaddr_nl *who, if (r->rtm_family == RTNL_FAMILY_IPMR || r->rtm_family == RTNL_FAMILY_IP6MR) { print_headers(fp, "[MROUTE]", ctrl); - print_mroute(who, n, arg); + print_mroute(n, arg); return 0; } else { print_headers(fp, "[ROUTE]", ctrl); - print_route(who, n, arg); + print_route(n, arg); return 0; } } case RTM_NEWLINK: case RTM_DELLINK: - ll_remember_index(who, n, NULL); + ll_remember_index(n, NULL); print_headers(fp, "[LINK]", ctrl); - print_linkinfo(who, n, arg); + print_linkinfo(n, arg); return 0; case RTM_NEWADDR: case RTM_DELADDR: print_headers(fp, "[ADDR]", ctrl); - print_addrinfo(who, n, arg); + print_addrinfo(n, arg); return 0; case RTM_NEWADDRLABEL: case RTM_DELADDRLABEL: print_headers(fp, "[ADDRLABEL]", ctrl); - print_addrlabel(who, n, arg); + print_addrlabel(n, arg); return 0; case RTM_NEWNEIGH: @@ -114,18 +113,18 @@ static int accept_msg(const struct sockaddr_nl *who, } print_headers(fp, "[NEIGH]", ctrl); - print_neigh(who, n, arg); + print_neigh(n, arg); return 0; case RTM_NEWPREFIX: print_headers(fp, "[PREFIX]", ctrl); - print_prefix(who, n, arg); + print_prefix(n, arg); return 0; case RTM_NEWRULE: case RTM_DELRULE: print_headers(fp, "[RULE]", ctrl); - print_rule(who, n, arg); + print_rule(n, arg); return 0; case NLMSG_TSTAMP: @@ -135,13 +134,13 @@ static int accept_msg(const struct sockaddr_nl *who, case RTM_NEWNETCONF: case RTM_DELNETCONF: print_headers(fp, "[NETCONF]", ctrl); - print_netconf(who, ctrl, n, arg); + print_netconf(ctrl, n, arg); return 0; case RTM_DELNSID: case RTM_NEWNSID: print_headers(fp, "[NSID]", ctrl); - print_nsid(who, n, arg); + print_nsid(n, arg); return 0; case NLMSG_ERROR: diff --git a/ip/ipmroute.c b/ip/ipmroute.c index c5dfa9cb1538..4d8867d3219f 100644 --- a/ip/ipmroute.c +++ b/ip/ipmroute.c @@ -52,7 +52,7 @@ struct rtfilter { inet_prefix msrc; } filter; -int print_mroute(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) +int print_mroute(struct nlmsghdr *n, void *arg) { struct rtmsg *r = NLMSG_DATA(n); int len = n->nlmsg_len; diff --git a/ip/ipneigh.c b/ip/ipneigh.c index 042d01fd24c2..6041c467749c 100644 --- a/ip/ipneigh.c +++ b/ip/ipneigh.c @@ -237,7 +237,7 @@ static void print_neigh_state(unsigned int nud) close_json_array(PRINT_JSON, NULL); } -int print_neigh(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) +int print_neigh(struct nlmsghdr *n, void *arg) { FILE *fp = (FILE *)arg; struct ndmsg *r = NLMSG_DATA(n); diff --git a/ip/ipnetconf.c b/ip/ipnetconf.c index 21822e367e11..0e946ca34b4a 100644 --- a/ip/ipnetconf.c +++ b/ip/ipnetconf.c @@ -55,8 +55,7 @@ static struct rtattr *netconf_rta(struct netconfmsg *ncm) + NLMSG_ALIGN(sizeof(struct netconfmsg))); } -int print_netconf(const struct sockaddr_nl *who, struct rtnl_ctrl_data *ctrl, - struct nlmsghdr *n, void *arg) +int print_netconf(struct rtnl_ctrl_data *ctrl, struct nlmsghdr *n, void *arg) { FILE *fp = (FILE *)arg; struct netconfmsg *ncm = NLMSG_DATA(n); @@ -154,10 +153,9 @@ int print_netconf(const struct sockaddr_nl *who, struct rtnl_ctrl_data *ctrl, return 0; } -static int print_netconf2(const struct sockaddr_nl *who, - struct nlmsghdr *n, void *arg) +static int print_netconf2(struct nlmsghdr *n, void *arg) { - return print_netconf(who, NULL, n, arg); + return print_netconf(NULL, n, arg); } void ipnetconf_reset_filter(int ifindex) diff --git a/ip/ipnetns.c b/ip/ipnetns.c index e8500c773994..0eac18cf2682 100644 --- a/ip/ipnetns.c +++ b/ip/ipnetns.c @@ -43,8 +43,7 @@ static struct rtnl_handle rtnsh = { .fd = -1 }; static int have_rtnl_getnsid = -1; -static int ipnetns_accept_msg(const struct sockaddr_nl *who, - struct rtnl_ctrl_data *ctrl, +static int ipnetns_accept_msg(struct rtnl_ctrl_data *ctrl, struct nlmsghdr *n, void *arg) { struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(n); @@ -284,7 +283,7 @@ static int netns_get_name(int nsid, char *name) return -ENOENT; } -int print_nsid(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) +int print_nsid(struct nlmsghdr *n, void *arg) { struct rtgenmsg *rthdr = NLMSG_DATA(n); struct rtattr *tb[NETNSA_MAX+1]; diff --git a/ip/ipntable.c b/ip/ipntable.c index ce3f4614e32b..5b61dd5cb001 100644 --- a/ip/ipntable.c +++ b/ip/ipntable.c @@ -520,8 +520,7 @@ static void print_ndtstats(const struct ndt_stats *ndts) print_nl(); } -static int print_ntable(const struct sockaddr_nl *who, - struct nlmsghdr *n, void *arg) +static int print_ntable(struct nlmsghdr *n, void *arg) { FILE *fp = (FILE *)arg; struct ndtmsg *ndtm = NLMSG_DATA(n); diff --git a/ip/ipprefix.c b/ip/ipprefix.c index 20f23ca799aa..466af2088d90 100644 --- a/ip/ipprefix.c +++ b/ip/ipprefix.c @@ -35,7 +35,7 @@ #define IF_PREFIX_ONLINK 0x01 #define IF_PREFIX_AUTOCONF 0x02 -int print_prefix(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) +int print_prefix(struct nlmsghdr *n, void *arg) { FILE *fp = (FILE *)arg; struct prefixmsg *prefix = NLMSG_DATA(n); diff --git a/ip/iproute.c b/ip/iproute.c index 699635923764..1326a6574fbe 100644 --- a/ip/iproute.c +++ b/ip/iproute.c @@ -708,7 +708,7 @@ static void print_rta_multipath(FILE *fp, const struct rtmsg *r, } } -int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) +int print_route(struct nlmsghdr *n, void *arg) { FILE *fp = (FILE *)arg; struct rtmsg *r = NLMSG_DATA(n); @@ -1580,8 +1580,7 @@ static int iproute_flush_cache(void) static __u32 route_dump_magic = 0x45311224; -static int save_route(const struct sockaddr_nl *who, struct nlmsghdr *n, - void *arg) +static int save_route(struct nlmsghdr *n, void *arg) { int ret; int len = n->nlmsg_len; @@ -2082,7 +2081,7 @@ static int iproute_get(int argc, char **argv) int len = answer->nlmsg_len; struct rtattr *tb[RTA_MAX+1]; - if (print_route(NULL, answer, (void *)stdout) < 0) { + if (print_route(answer, (void *)stdout) < 0) { fprintf(stderr, "An error :-)\n"); free(answer); return -1; @@ -2126,7 +2125,7 @@ static int iproute_get(int argc, char **argv) return -2; } - if (print_route(NULL, answer, (void *)stdout) < 0) { + if (print_route(answer, (void *)stdout) < 0) { fprintf(stderr, "An error :-)\n"); free(answer); return -1; @@ -2144,8 +2143,7 @@ static int rtattr_cmp(const struct rtattr *rta1, const struct rtattr *rta2) return memcmp(RTA_DATA(rta1), RTA_DATA(rta2), RTA_PAYLOAD(rta1)); } -static int restore_handler(const struct sockaddr_nl *nl, - struct rtnl_ctrl_data *ctrl, +static int restore_handler(struct rtnl_ctrl_data *ctrl, struct nlmsghdr *n, void *arg) { struct rtmsg *r = NLMSG_DATA(n); @@ -2231,11 +2229,10 @@ static int iproute_restore(void) return 0; } -static int show_handler(const struct sockaddr_nl *nl, - struct rtnl_ctrl_data *ctrl, +static int show_handler(struct rtnl_ctrl_data *ctrl, struct nlmsghdr *n, void *arg) { - print_route(nl, n, stdout); + print_route(n, stdout); return 0; } diff --git a/ip/iprule.c b/ip/iprule.c index 60fd4c7e9f93..d89d808d8909 100644 --- a/ip/iprule.c +++ b/ip/iprule.c @@ -181,7 +181,7 @@ static bool filter_nlmsg(struct nlmsghdr *n, struct rtattr **tb, int host_len) return true; } -int print_rule(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) +int print_rule(struct nlmsghdr *n, void *arg) { FILE *fp = arg; struct fib_rule_hdr *frh = NLMSG_DATA(n); @@ -442,8 +442,7 @@ static int save_rule_prep(void) return 0; } -static int save_rule(const struct sockaddr_nl *who, - struct nlmsghdr *n, void *arg) +static int save_rule(struct nlmsghdr *n, void *arg) { int ret; @@ -456,8 +455,7 @@ static int save_rule(const struct sockaddr_nl *who, return ret == n->nlmsg_len ? 0 : ret; } -static int flush_rule(const struct sockaddr_nl *who, struct nlmsghdr *n, - void *arg) +static int flush_rule(struct nlmsghdr *n, void *arg) { struct rtnl_handle rth2; struct fib_rule_hdr *frh = NLMSG_DATA(n); @@ -650,8 +648,7 @@ static int rule_dump_check_magic(void) return 0; } -static int restore_handler(const struct sockaddr_nl *nl, - struct rtnl_ctrl_data *ctrl, +static int restore_handler(struct rtnl_ctrl_data *ctrl, struct nlmsghdr *n, void *arg) { int ret; diff --git a/ip/ipseg6.c b/ip/ipseg6.c index 6f5ae4d239f7..33076e726de6 100644 --- a/ip/ipseg6.c +++ b/ip/ipseg6.c @@ -99,8 +99,7 @@ static void print_tunsrc(struct rtattr *attrs[]) "tunsrc addr %s\n", dst); } -static int process_msg(const struct sockaddr_nl *who, struct nlmsghdr *n, - void *arg) +static int process_msg(struct nlmsghdr *n, void *arg) { struct rtattr *attrs[SEG6_ATTR_MAX + 1]; struct genlmsghdr *ghdr; @@ -180,7 +179,7 @@ static int seg6_do_cmd(void) if (rtnl_talk(&grth, &req.n, &answer) < 0) return -2; new_json_obj(json); - if (process_msg(NULL, answer, stdout) < 0) { + if (process_msg(answer, stdout) < 0) { fprintf(stderr, "Error parsing reply\n"); exit(1); } diff --git a/ip/iptoken.c b/ip/iptoken.c index 8605e75c4edc..f1194c3e1aa4 100644 --- a/ip/iptoken.c +++ b/ip/iptoken.c @@ -42,7 +42,7 @@ static void usage(void) exit(-1); } -static int print_token(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) +static int print_token(struct nlmsghdr *n, void *arg) { struct rtnl_dump_args *args = arg; FILE *fp = args->fp; diff --git a/ip/iptuntap.c b/ip/iptuntap.c index 8c84e6206fa9..528055a0bf46 100644 --- a/ip/iptuntap.c +++ b/ip/iptuntap.c @@ -386,8 +386,7 @@ static int tuntap_filter_req(struct nlmsghdr *nlh, int reqlen) return 0; } -static int print_tuntap(const struct sockaddr_nl *who, - struct nlmsghdr *n, void *arg) +static int print_tuntap(struct nlmsghdr *n, void *arg) { struct ifinfomsg *ifi = NLMSG_DATA(n); struct rtattr *tb[IFLA_MAX+1]; diff --git a/ip/rtmon.c b/ip/rtmon.c index 7d2405d724a6..7373443f2f8a 100644 --- a/ip/rtmon.c +++ b/ip/rtmon.c @@ -43,7 +43,7 @@ static void write_stamp(FILE *fp) fwrite((void *)n1, 1, NLMSG_ALIGN(n1->nlmsg_len), fp); } -static int dump_msg(const struct sockaddr_nl *who, struct rtnl_ctrl_data *ctrl, +static int dump_msg(struct rtnl_ctrl_data *ctrl, struct nlmsghdr *n, void *arg) { FILE *fp = (FILE *)arg; @@ -55,10 +55,9 @@ static int dump_msg(const struct sockaddr_nl *who, struct rtnl_ctrl_data *ctrl, return 0; } -static int dump_msg2(const struct sockaddr_nl *who, - struct nlmsghdr *n, void *arg) +static int dump_msg2(struct nlmsghdr *n, void *arg) { - return dump_msg(who, NULL, n, arg); + return dump_msg(NULL, n, arg); } static void usage(void) diff --git a/ip/tcp_metrics.c b/ip/tcp_metrics.c index ad3d6f363003..72ef3ab5cfda 100644 --- a/ip/tcp_metrics.c +++ b/ip/tcp_metrics.c @@ -156,8 +156,7 @@ static void print_tcp_metrics(struct rtattr *a) } } -static int process_msg(const struct sockaddr_nl *who, struct nlmsghdr *n, - void *arg) +static int process_msg(struct nlmsghdr *n, void *arg) { FILE *fp = (FILE *) arg; struct genlmsghdr *ghdr; @@ -501,7 +500,7 @@ static int tcpm_do_cmd(int cmd, int argc, char **argv) } else if (atype >= 0) { if (rtnl_talk(&grth, &req.n, &answer) < 0) return -2; - if (process_msg(NULL, answer, stdout) < 0) { + if (process_msg(answer, stdout) < 0) { fprintf(stderr, "Dump terminated\n"); exit(1); } diff --git a/ip/tunnel.c b/ip/tunnel.c index 20fe6d7d72f1..d0d55f37169e 100644 --- a/ip/tunnel.c +++ b/ip/tunnel.c @@ -321,8 +321,7 @@ static void tnl_print_stats(const struct rtnl_link_stats64 *s) s->tx_carrier_errors, s->tx_dropped); } -static int print_nlmsg_tunnel(const struct sockaddr_nl *who, - struct nlmsghdr *n, void *arg) +static int print_nlmsg_tunnel(struct nlmsghdr *n, void *arg) { struct tnl_print_nlmsg_info *info = arg; struct ifinfomsg *ifi = NLMSG_DATA(n); diff --git a/ip/xfrm.h b/ip/xfrm.h index 71be574d90d8..3b158ad71c13 100644 --- a/ip/xfrm.h +++ b/ip/xfrm.h @@ -104,10 +104,8 @@ struct xfrm_filter { extern struct xfrm_filter filter; -int xfrm_state_print(const struct sockaddr_nl *who, struct nlmsghdr *n, - void *arg); -int xfrm_policy_print(const struct sockaddr_nl *who, struct nlmsghdr *n, - void *arg); +int xfrm_state_print(struct nlmsghdr *n, void *arg); +int xfrm_policy_print(struct nlmsghdr *n, void *arg); int do_xfrm_state(int argc, char **argv); int do_xfrm_policy(int argc, char **argv); int do_xfrm_monitor(int argc, char **argv); diff --git a/ip/xfrm_monitor.c b/ip/xfrm_monitor.c index 5d086768560e..eb07af17cadf 100644 --- a/ip/xfrm_monitor.c +++ b/ip/xfrm_monitor.c @@ -43,8 +43,7 @@ static void usage(void) exit(-1); } -static int xfrm_acquire_print(const struct sockaddr_nl *who, - struct nlmsghdr *n, void *arg) +static int xfrm_acquire_print(struct nlmsghdr *n, void *arg) { FILE *fp = (FILE *)arg; struct xfrm_user_acquire *xacq = NLMSG_DATA(n); @@ -105,8 +104,7 @@ static int xfrm_acquire_print(const struct sockaddr_nl *who, return 0; } -static int xfrm_state_flush_print(const struct sockaddr_nl *who, - struct nlmsghdr *n, void *arg) +static int xfrm_state_flush_print(struct nlmsghdr *n, void *arg) { FILE *fp = (FILE *)arg; struct xfrm_usersa_flush *xsf = NLMSG_DATA(n); @@ -135,8 +133,7 @@ static int xfrm_state_flush_print(const struct sockaddr_nl *who, return 0; } -static int xfrm_policy_flush_print(const struct sockaddr_nl *who, - struct nlmsghdr *n, void *arg) +static int xfrm_policy_flush_print(struct nlmsghdr *n, void *arg) { struct rtattr *tb[XFRMA_MAX+1]; FILE *fp = (FILE *)arg; @@ -173,8 +170,7 @@ static int xfrm_policy_flush_print(const struct sockaddr_nl *who, return 0; } -static int xfrm_report_print(const struct sockaddr_nl *who, - struct nlmsghdr *n, void *arg) +static int xfrm_report_print(struct nlmsghdr *n, void *arg) { FILE *fp = (FILE *)arg; struct xfrm_user_report *xrep = NLMSG_DATA(n); @@ -236,8 +232,7 @@ static void xfrm_usersa_print(const struct xfrm_usersa_id *sa_id, __u32 reqid, F fprintf(fp, " SPI 0x%x", ntohl(sa_id->spi)); } -static int xfrm_ae_print(const struct sockaddr_nl *who, - struct nlmsghdr *n, void *arg) +static int xfrm_ae_print(struct nlmsghdr *n, void *arg) { FILE *fp = (FILE *)arg; struct xfrm_aevent_id *id = NLMSG_DATA(n); @@ -261,8 +256,7 @@ static void xfrm_print_addr(FILE *fp, int family, xfrm_address_t *a) fprintf(fp, "%s", rt_addr_n2a(family, sizeof(*a), a)); } -static int xfrm_mapping_print(const struct sockaddr_nl *who, - struct nlmsghdr *n, void *arg) +static int xfrm_mapping_print(struct nlmsghdr *n, void *arg) { FILE *fp = (FILE *)arg; struct xfrm_user_mapping *map = NLMSG_DATA(n); @@ -281,8 +275,7 @@ static int xfrm_mapping_print(const struct sockaddr_nl *who, return 0; } -static int xfrm_accept_msg(const struct sockaddr_nl *who, - struct rtnl_ctrl_data *ctrl, +static int xfrm_accept_msg(struct rtnl_ctrl_data *ctrl, struct nlmsghdr *n, void *arg) { FILE *fp = (FILE *)arg; @@ -302,31 +295,31 @@ static int xfrm_accept_msg(const struct sockaddr_nl *who, case XFRM_MSG_DELSA: case XFRM_MSG_UPDSA: case XFRM_MSG_EXPIRE: - xfrm_state_print(who, n, arg); + xfrm_state_print(n, arg); return 0; case XFRM_MSG_NEWPOLICY: case XFRM_MSG_DELPOLICY: case XFRM_MSG_UPDPOLICY: case XFRM_MSG_POLEXPIRE: - xfrm_policy_print(who, n, arg); + xfrm_policy_print(n, arg); return 0; case XFRM_MSG_ACQUIRE: - xfrm_acquire_print(who, n, arg); + xfrm_acquire_print(n, arg); return 0; case XFRM_MSG_FLUSHSA: - xfrm_state_flush_print(who, n, arg); + xfrm_state_flush_print(n, arg); return 0; case XFRM_MSG_FLUSHPOLICY: - xfrm_policy_flush_print(who, n, arg); + xfrm_policy_flush_print(n, arg); return 0; case XFRM_MSG_REPORT: - xfrm_report_print(who, n, arg); + xfrm_report_print(n, arg); return 0; case XFRM_MSG_NEWAE: - xfrm_ae_print(who, n, arg); + xfrm_ae_print(n, arg); return 0; case XFRM_MSG_MAPPING: - xfrm_mapping_print(who, n, arg); + xfrm_mapping_print(n, arg); return 0; default: break; diff --git a/ip/xfrm_policy.c b/ip/xfrm_policy.c index d54402691ca0..feccaadac2db 100644 --- a/ip/xfrm_policy.c +++ b/ip/xfrm_policy.c @@ -453,8 +453,7 @@ static int xfrm_policy_filter_match(struct xfrm_userpolicy_info *xpinfo, return 1; } -int xfrm_policy_print(const struct sockaddr_nl *who, struct nlmsghdr *n, - void *arg) +int xfrm_policy_print(struct nlmsghdr *n, void *arg) { struct rtattr *tb[XFRMA_MAX+1]; struct rtattr *rta; @@ -681,7 +680,7 @@ static int xfrm_policy_get(int argc, char **argv) xfrm_policy_get_or_delete(argc, argv, 0, &n); - if (xfrm_policy_print(NULL, n, (void *)stdout) < 0) { + if (xfrm_policy_print(n, (void *)stdout) < 0) { fprintf(stderr, "An error :-)\n"); exit(1); } @@ -694,9 +693,7 @@ static int xfrm_policy_get(int argc, char **argv) * With an existing policy of nlmsg, make new nlmsg for deleting the policy * and store it to buffer. */ -static int xfrm_policy_keep(const struct sockaddr_nl *who, - struct nlmsghdr *n, - void *arg) +static int xfrm_policy_keep(struct nlmsghdr *n, void *arg) { struct xfrm_buffer *xb = (struct xfrm_buffer *)arg; struct rtnl_handle *rth = xb->rth; diff --git a/ip/xfrm_state.c b/ip/xfrm_state.c index 913e9fa3bbdb..3cfcad1a4712 100644 --- a/ip/xfrm_state.c +++ b/ip/xfrm_state.c @@ -869,7 +869,7 @@ static int xfrm_state_allocspi(int argc, char **argv) if (rtnl_talk(&rth, &req.n, &answer) < 0) exit(2); - if (xfrm_state_print(NULL, answer, (void *)stdout) < 0) { + if (xfrm_state_print(answer, (void *)stdout) < 0) { fprintf(stderr, "An error :-)\n"); exit(1); } @@ -908,8 +908,7 @@ static int xfrm_state_filter_match(struct xfrm_usersa_info *xsinfo) return 1; } -int xfrm_state_print(const struct sockaddr_nl *who, struct nlmsghdr *n, - void *arg) +int xfrm_state_print(struct nlmsghdr *n, void *arg) { FILE *fp = (FILE *)arg; struct rtattr *tb[XFRMA_MAX+1]; @@ -1063,7 +1062,7 @@ static int xfrm_state_get_or_delete(int argc, char **argv, int delete) if (rtnl_talk(&rth, &req.n, &answer) < 0) exit(2); - if (xfrm_state_print(NULL, answer, (void *)stdout) < 0) { + if (xfrm_state_print(answer, (void *)stdout) < 0) { fprintf(stderr, "An error :-)\n"); exit(1); } @@ -1080,9 +1079,7 @@ static int xfrm_state_get_or_delete(int argc, char **argv, int delete) * With an existing state of nlmsg, make new nlmsg for deleting the state * and store it to buffer. */ -static int xfrm_state_keep(const struct sockaddr_nl *who, - struct nlmsghdr *n, - void *arg) +static int xfrm_state_keep(struct nlmsghdr *n, void *arg) { struct xfrm_buffer *xb = (struct xfrm_buffer *)arg; struct rtnl_handle *rth = xb->rth; diff --git a/lib/libnetlink.c b/lib/libnetlink.c index e8202f7915ba..fe4a7a4b9c71 100644 --- a/lib/libnetlink.c +++ b/lib/libnetlink.c @@ -674,7 +674,7 @@ int rtnl_dump_filter_l(struct rtnl_handle *rth, } if (!rth->dump_fp) { - err = a->filter(&nladdr, h, a->arg1); + err = a->filter(h, a->arg1); if (err < 0) { free(buf); return err; @@ -983,7 +983,7 @@ int rtnl_listen(struct rtnl_handle *rtnl, exit(1); } - err = handler(&nladdr, &ctrl, h, jarg); + err = handler(&ctrl, h, jarg); if (err < 0) return err; @@ -1005,7 +1005,6 @@ int rtnl_from_file(FILE *rtnl, rtnl_listen_filter_t handler, void *jarg) { int status; - struct sockaddr_nl nladdr = { .nl_family = AF_NETLINK }; char buf[16384]; struct nlmsghdr *h = (struct nlmsghdr *)buf; @@ -1044,7 +1043,7 @@ int rtnl_from_file(FILE *rtnl, rtnl_listen_filter_t handler, return -1; } - err = handler(&nladdr, NULL, h, jarg); + err = handler(NULL, h, jarg); if (err < 0) return err; } diff --git a/lib/ll_map.c b/lib/ll_map.c index 32c8e4429fca..1b4095a7d873 100644 --- a/lib/ll_map.c +++ b/lib/ll_map.c @@ -77,8 +77,7 @@ static struct ll_cache *ll_get_by_name(const char *name) return NULL; } -int ll_remember_index(const struct sockaddr_nl *who, - struct nlmsghdr *n, void *arg) +int ll_remember_index(struct nlmsghdr *n, void *arg) { unsigned int h; const char *ifname; diff --git a/misc/ifstat.c b/misc/ifstat.c index 3a0e780f7569..60efe6cb60fa 100644 --- a/misc/ifstat.c +++ b/misc/ifstat.c @@ -110,8 +110,7 @@ static int match(const char *id) return 0; } -static int get_nlmsg_extended(const struct sockaddr_nl *who, - struct nlmsghdr *m, void *arg) +static int get_nlmsg_extended(struct nlmsghdr *m, void *arg) { struct if_stats_msg *ifsm = NLMSG_DATA(m); struct rtattr *tb[IFLA_STATS_MAX+1]; @@ -154,8 +153,7 @@ static int get_nlmsg_extended(const struct sockaddr_nl *who, return 0; } -static int get_nlmsg(const struct sockaddr_nl *who, - struct nlmsghdr *m, void *arg) +static int get_nlmsg(struct nlmsghdr *m, void *arg) { struct ifinfomsg *ifi = NLMSG_DATA(m); struct rtattr *tb[IFLA_MAX+1]; diff --git a/misc/ss.c b/misc/ss.c index f99b6874c228..c8970438ce73 100644 --- a/misc/ss.c +++ b/misc/ss.c @@ -3156,8 +3156,7 @@ static int kill_inet_sock(struct nlmsghdr *h, void *arg, struct sockstat *s) return rtnl_talk(rth, &req.nlh, NULL); } -static int show_one_inet_sock(const struct sockaddr_nl *addr, - struct nlmsghdr *h, void *arg) +static int show_one_inet_sock(struct nlmsghdr *h, void *arg) { int err; struct inet_diag_arg *diag_arg = arg; @@ -3548,8 +3547,7 @@ static void unix_stats_print(struct sockstat *s, struct filter *f) proc_ctx_print(s); } -static int unix_show_sock(const struct sockaddr_nl *addr, struct nlmsghdr *nlh, - void *arg) +static int unix_show_sock(struct nlmsghdr *nlh, void *arg) { struct filter *f = (struct filter *)arg; struct unix_diag_msg *r = NLMSG_DATA(nlh); @@ -3843,8 +3841,7 @@ static void packet_show_ring(struct packet_diag_ring *ring) out(",features:0x%x", ring->pdr_features); } -static int packet_show_sock(const struct sockaddr_nl *addr, - struct nlmsghdr *nlh, void *arg) +static int packet_show_sock(struct nlmsghdr *nlh, void *arg) { const struct filter *f = arg; struct packet_diag_msg *r = NLMSG_DATA(nlh); @@ -4133,8 +4130,7 @@ static int netlink_show_one(struct filter *f, return 0; } -static int netlink_show_sock(const struct sockaddr_nl *addr, - struct nlmsghdr *nlh, void *arg) +static int netlink_show_sock(struct nlmsghdr *nlh, void *arg) { struct filter *f = (struct filter *)arg; struct netlink_diag_msg *r = NLMSG_DATA(nlh); @@ -4257,8 +4253,7 @@ static void vsock_stats_print(struct sockstat *s, struct filter *f) proc_ctx_print(s); } -static int vsock_show_sock(const struct sockaddr_nl *addr, - struct nlmsghdr *nlh, void *arg) +static int vsock_show_sock(struct nlmsghdr *nlh, void *arg) { struct filter *f = (struct filter *)arg; struct vsock_diag_msg *r = NLMSG_DATA(nlh); @@ -4311,8 +4306,7 @@ static void tipc_sock_addr_print(struct rtattr *net_addr, struct rtattr *id) } -static int tipc_show_sock(const struct sockaddr_nl *addr, struct nlmsghdr *nlh, - void *arg) +static int tipc_show_sock(struct nlmsghdr *nlh, void *arg) { struct rtattr *stat[TIPC_NLA_SOCK_STAT_MAX + 1] = {}; struct rtattr *attrs[TIPC_NLA_SOCK_MAX + 1] = {}; @@ -4400,8 +4394,7 @@ struct sock_diag_msg { __u8 sdiag_family; }; -static int generic_show_sock(const struct sockaddr_nl *addr, - struct nlmsghdr *nlh, void *arg) +static int generic_show_sock(struct nlmsghdr *nlh, void *arg) { struct sock_diag_msg *r = NLMSG_DATA(nlh); struct inet_diag_arg inet_arg = { .f = arg, .protocol = IPPROTO_MAX }; @@ -4411,19 +4404,19 @@ static int generic_show_sock(const struct sockaddr_nl *addr, case AF_INET: case AF_INET6: inet_arg.rth = inet_arg.f->rth_for_killing; - ret = show_one_inet_sock(addr, nlh, &inet_arg); + ret = show_one_inet_sock(nlh, &inet_arg); break; case AF_UNIX: - ret = unix_show_sock(addr, nlh, arg); + ret = unix_show_sock(nlh, arg); break; case AF_PACKET: - ret = packet_show_sock(addr, nlh, arg); + ret = packet_show_sock(nlh, arg); break; case AF_NETLINK: - ret = netlink_show_sock(addr, nlh, arg); + ret = netlink_show_sock(nlh, arg); break; case AF_VSOCK: - ret = vsock_show_sock(addr, nlh, arg); + ret = vsock_show_sock(nlh, arg); break; default: ret = -1; diff --git a/tc/m_action.c b/tc/m_action.c index 8993b93a5c4b..e90867fc6c25 100644 --- a/tc/m_action.c +++ b/tc/m_action.c @@ -386,9 +386,7 @@ tc_print_action(FILE *f, const struct rtattr *arg, unsigned short tot_acts) return 0; } -int print_action(const struct sockaddr_nl *who, - struct nlmsghdr *n, - void *arg) +int print_action(struct nlmsghdr *n, void *arg) { FILE *fp = (FILE *)arg; struct tcamsg *t = NLMSG_DATA(n); @@ -541,7 +539,7 @@ static int tc_action_gd(int cmd, unsigned int flags, if (cmd == RTM_GETACTION) { new_json_obj(json); - ret = print_action(NULL, ans, stdout); + ret = print_action(ans, stdout); if (ret < 0) { fprintf(stderr, "Dump terminated\n"); free(ans); diff --git a/tc/tc_class.c b/tc/tc_class.c index 6b4ea48073f2..7e4e17fd7f39 100644 --- a/tc/tc_class.c +++ b/tc/tc_class.c @@ -296,8 +296,7 @@ static void graph_cls_show(FILE *fp, char *buf, struct hlist_head *root_list, } } -int print_class(const struct sockaddr_nl *who, - struct nlmsghdr *n, void *arg) +int print_class(struct nlmsghdr *n, void *arg) { FILE *fp = (FILE *)arg; struct tcmsg *t = NLMSG_DATA(n); diff --git a/tc/tc_common.h b/tc/tc_common.h index 371ca7d04602..d8a6dfdeabd4 100644 --- a/tc/tc_common.h +++ b/tc/tc_common.h @@ -13,10 +13,10 @@ int do_action(int argc, char **argv, void *buf, size_t buflen); int do_tcmonitor(int argc, char **argv); int do_exec(int argc, char **argv); -int print_action(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg); -int print_filter(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg); -int print_qdisc(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg); -int print_class(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg); +int print_action(struct nlmsghdr *n, void *arg); +int print_filter(struct nlmsghdr *n, void *arg); +int print_qdisc(struct nlmsghdr *n, void *arg); +int print_class(struct nlmsghdr *n, void *arg); void print_size_table(FILE *fp, const char *prefix, struct rtattr *rta); struct tc_estimator; diff --git a/tc/tc_filter.c b/tc/tc_filter.c index 15044b4bc6ed..e5c7bc4605a2 100644 --- a/tc/tc_filter.c +++ b/tc/tc_filter.c @@ -258,7 +258,7 @@ static int filter_chain_index_set; static __u32 filter_block_index; __u16 f_proto; -int print_filter(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) +int print_filter(struct nlmsghdr *n, void *arg) { FILE *fp = (FILE *)arg; struct tcmsg *t = NLMSG_DATA(n); @@ -592,7 +592,7 @@ static int tc_filter_get(int cmd, unsigned int flags, int argc, char **argv) } new_json_obj(json); - print_filter(NULL, answer, (void *)stdout); + print_filter(answer, (void *)stdout); delete_json_obj(); free(answer); diff --git a/tc/tc_monitor.c b/tc/tc_monitor.c index 1f1ee08fb9cf..f8816cc53a46 100644 --- a/tc/tc_monitor.c +++ b/tc/tc_monitor.c @@ -34,8 +34,7 @@ static void usage(void) } -static int accept_tcmsg(const struct sockaddr_nl *who, - struct rtnl_ctrl_data *ctrl, +static int accept_tcmsg(struct rtnl_ctrl_data *ctrl, struct nlmsghdr *n, void *arg) { FILE *fp = (FILE *)arg; @@ -47,20 +46,20 @@ static int accept_tcmsg(const struct sockaddr_nl *who, n->nlmsg_type == RTM_DELTFILTER || n->nlmsg_type == RTM_NEWCHAIN || n->nlmsg_type == RTM_DELCHAIN) { - print_filter(who, n, arg); + print_filter(n, arg); return 0; } if (n->nlmsg_type == RTM_NEWTCLASS || n->nlmsg_type == RTM_DELTCLASS) { - print_class(who, n, arg); + print_class(n, arg); return 0; } if (n->nlmsg_type == RTM_NEWQDISC || n->nlmsg_type == RTM_DELQDISC) { - print_qdisc(who, n, arg); + print_qdisc(n, arg); return 0; } if (n->nlmsg_type == RTM_GETACTION || n->nlmsg_type == RTM_NEWACTION || n->nlmsg_type == RTM_DELACTION) { - print_action(who, n, arg); + print_action(n, arg); return 0; } if (n->nlmsg_type != NLMSG_ERROR && n->nlmsg_type != NLMSG_NOOP && diff --git a/tc/tc_qdisc.c b/tc/tc_qdisc.c index c1d2df0171a7..c5da5b5c1ed5 100644 --- a/tc/tc_qdisc.c +++ b/tc/tc_qdisc.c @@ -212,8 +212,7 @@ static int tc_qdisc_modify(int cmd, unsigned int flags, int argc, char **argv) static int filter_ifindex; -int print_qdisc(const struct sockaddr_nl *who, - struct nlmsghdr *n, void *arg) +int print_qdisc(struct nlmsghdr *n, void *arg) { FILE *fp = (FILE *)arg; struct tcmsg *t = NLMSG_DATA(n); @@ -448,8 +447,7 @@ struct tc_qdisc_block_exists_ctx { bool found; }; -static int tc_qdisc_block_exists_cb(const struct sockaddr_nl *who, - struct nlmsghdr *n, void *arg) +static int tc_qdisc_block_exists_cb(struct nlmsghdr *n, void *arg) { struct tc_qdisc_block_exists_ctx *ctx = arg; struct tcmsg *t = NLMSG_DATA(n); -- 2.11.0