mirror of
https://git.proxmox.com/git/mirror_iproute2
synced 2026-01-05 22:07:08 +00:00
Tree wide: Drop sockaddr_nl arg
No function, filter, or print function uses the sockaddr_nl arg, so just drop it. Signed-off-by: David Ahern <dsahern@gmail.com> Acked-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
parent
9d16a1de1f
commit
cd554f2c2f
@ -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);
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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];
|
||||
|
||||
10
genl/ctrl.c
10
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;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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];
|
||||
|
||||
@ -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];
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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(unsigned int flags, 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];
|
||||
|
||||
@ -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];
|
||||
|
||||
@ -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];
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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];
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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);
|
||||
|
||||
17
ip/iproute.c
17
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;
|
||||
}
|
||||
|
||||
|
||||
11
ip/iprule.c
11
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;
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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];
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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];
|
||||
|
||||
31
misc/ss.c
31
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;
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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 &&
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user