Lines Matching defs:h

1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4 #include <err.h>
5 #include <errno.h>
7 #include <sys/bitcount.h>
8 #include <sys/param.h>
9 #include <sys/linker.h>
10 #include <sys/module.h>
11 #include <sys/socket.h>
12 #include <sys/sysctl.h>
13 #include <sys/time.h>
14 #include <sys/types.h>
16 #include <netinet/in.h>
17 #include <arpa/inet.h>
19 #include <net/ethernet.h>
20 #include <net/if.h>
21 #include <net/if_dl.h>
22 #include <net/if_types.h>
23 #include <netlink/netlink.h>
24 #include <netlink/netlink_route.h>
25 #include <netlink/netlink_snl.h>
26 #include <netlink/netlink_snl_route.h>
27 #include <netlink/netlink_snl_route_compat.h>
28 #include <netlink/netlink_snl_route_parsers.h>
43 static void print_getmsg(struct nl_helper *h, struct nlmsghdr *hdr,
45 static void print_nlmsg(struct nl_helper *h, struct nlmsghdr *hdr,
120 nl_helper_init(struct nl_helper *h)
122 nl_init_socket(&h->ss_cmd);
126 nl_helper_free(struct nl_helper *h)
128 snl_free(&h->ss_cmd);
142 rtmsg_nl_int(struct nl_helper *h, int cmd, int rtm_flags, int fib, int rtm_addrs,
145 struct snl_state *ss = &h->ss_cmd;
275 print_getmsg(h, hdr, dst);
302 struct nl_helper h = {};
304 nl_helper_init(&h);
305 int error = rtmsg_nl_int(&h, cmd, rtm_flags, fib, rtm_addrs, so, rt_metrics);
306 nl_helper_free(&h);
312 get_ifdata(struct nl_helper *h, uint32_t ifindex, struct snl_parsed_link_simple *link)
314 struct snl_state *ss = &h->ss_cmd;
343 print_getmsg(struct nl_helper *h, struct nlmsghdr *hdr, struct sockaddr *dst)
345 struct snl_state *ss = &h->ss_cmd;
353 get_ifdata(h, r.rta_oif, &link);
396 print_prefix(struct nl_helper *h, char *buf, int bufsize, struct sockaddr *sa, int plen)
426 get_ifdata(h, sin6->sin6_scope_id, &link);
474 print_nlmsg_route_nhop(struct nl_helper *h, struct snl_parsed_route *r,
480 print_prefix(h, gwbuf, sizeof(gwbuf), nh->gw, -1);
487 get_ifdata(h, nh->ifindex, &link);
510 print_nlmsg_route(struct nl_helper *h, struct nlmsghdr *hdr,
514 struct snl_state *ss = &h->ss_cmd;
525 print_prefix(h, buf, sizeof(buf), r.rta_dst, r.rtm_dst_len);
552 print_nlmsg_route_nhop(h, &r, nh, first);
562 print_nlmsg_route_nhop(h, &r, &nh, true);
577 print_nlmsg_link(struct nl_helper *h, struct nlmsghdr *hdr,
581 struct snl_state *ss = &h->ss_cmd;
601 print_nlmsg_addr(struct nl_helper *h, struct nlmsghdr *hdr,
605 struct snl_state *ss = &h->ss_cmd;
616 print_prefix(h, buf, sizeof(buf), addr, attrs.ifa_prefixlen);
620 get_ifdata(h, attrs.ifa_index, &link);
624 print_prefix(h, buf, sizeof(buf), attrs.ifa_address, -1);
651 print_nlmsg_neigh(struct nl_helper *h, struct nlmsghdr *hdr,
655 struct snl_state *ss = &h->ss_cmd;
665 print_prefix(h, buf, sizeof(buf), attrs.nda_dst, -1);
669 get_ifdata(h, attrs.nda_ifindex, &link);
710 print_nlmsg_generic(struct nl_helper *h, struct nlmsghdr *hdr, struct snl_msg_info *cinfo)
718 print_nlmsg(struct nl_helper *h, struct nlmsghdr *hdr, struct snl_msg_info *cinfo)
723 print_nlmsg_link(h, hdr, cinfo);
727 print_nlmsg_addr(h, hdr, cinfo);
731 print_nlmsg_route(h, hdr, cinfo);
735 print_nlmsg_neigh(h, hdr, cinfo);
738 print_nlmsg_generic(h, hdr, cinfo);
741 snl_clear_lb(&h->ss_cmd);
748 struct nl_helper h;
751 nl_helper_init(&h);
785 print_nlmsg(&h, hdr, &attrs);
786 snl_clear_lb(&h.ss_cmd);
791 nl_helper_free(&h);
809 flushroute_one(struct nl_helper *h, struct snl_parsed_route *r)
811 struct snl_state *ss = &h->ss_cmd;
839 print_nlmsg(h, hdr, &attrs);
861 struct nl_helper h = {};
880 nl_helper_init(&h);
890 print_nlmsg(&h, hdr, &attrs);
899 if ((error = flushroute_one(&h, &r)) != 0) {
905 snl_clear_lb(&h.ss_cmd);
909 nl_helper_free(&h);