diff options
Diffstat (limited to 'src/lib/libnetlink.c')
-rw-r--r-- | src/lib/libnetlink.c | 46 |
1 files changed, 6 insertions, 40 deletions
diff --git a/src/lib/libnetlink.c b/src/lib/libnetlink.c index 836cf417d..417ef2c5f 100644 --- a/src/lib/libnetlink.c +++ b/src/lib/libnetlink.c | |||
@@ -105,6 +105,7 @@ int rtnl_open(struct rtnl_handle *rth, unsigned subscriptions) | |||
105 | return rtnl_open_byproto(rth, subscriptions, NETLINK_ROUTE); | 105 | return rtnl_open_byproto(rth, subscriptions, NETLINK_ROUTE); |
106 | } | 106 | } |
107 | 107 | ||
108 | #if 0 | ||
108 | int rtnl_wilddump_request(struct rtnl_handle *rth, int family, int type) | 109 | int rtnl_wilddump_request(struct rtnl_handle *rth, int family, int type) |
109 | { | 110 | { |
110 | return rtnl_wilddump_req_filter(rth, family, type, RTEXT_FILTER_VF); | 111 | return rtnl_wilddump_req_filter(rth, family, type, RTEXT_FILTER_VF); |
@@ -303,6 +304,7 @@ int rtnl_dump_filter(struct rtnl_handle *rth, | |||
303 | 304 | ||
304 | return rtnl_dump_filter_l(rth, a); | 305 | return rtnl_dump_filter_l(rth, a); |
305 | } | 306 | } |
307 | #endif | ||
306 | 308 | ||
307 | int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, pid_t peer, | 309 | int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, pid_t peer, |
308 | unsigned groups, struct nlmsghdr *answer) | 310 | unsigned groups, struct nlmsghdr *answer) |
@@ -422,6 +424,7 @@ int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, pid_t peer, | |||
422 | } | 424 | } |
423 | } | 425 | } |
424 | 426 | ||
427 | #if 0 | ||
425 | int rtnl_listen(struct rtnl_handle *rtnl, | 428 | int rtnl_listen(struct rtnl_handle *rtnl, |
426 | rtnl_filter_t handler, | 429 | rtnl_filter_t handler, |
427 | void *jarg) | 430 | void *jarg) |
@@ -580,7 +583,7 @@ int addattrstrz(struct nlmsghdr *n, int maxlen, int type, const char *str) | |||
580 | { | 583 | { |
581 | return addattr_l(n, maxlen, type, str, strlen(str)+1); | 584 | return addattr_l(n, maxlen, type, str, strlen(str)+1); |
582 | } | 585 | } |
583 | 586 | #endif | |
584 | 587 | ||
585 | 588 | ||
586 | int addattr_l(struct nlmsghdr *n, int maxlen, int type, const void *data, | 589 | int addattr_l(struct nlmsghdr *n, int maxlen, int type, const void *data, |
@@ -632,46 +635,8 @@ printf("\tdata length: %d\n", alen); | |||
632 | return 0; | 635 | return 0; |
633 | } | 636 | } |
634 | 637 | ||
635 | #if 0 | ||
636 | int addattr_l(struct nlmsghdr *n, int maxlen, int type, const void *data, | ||
637 | int alen) | ||
638 | { | ||
639 | printf("%s: adding type %d, length %d ", __FUNCTION__, type, alen); | ||
640 | if (type == IFLA_INFO_KIND) { | ||
641 | if (alen) | ||
642 | printf("(IFLA_INFO_KIND %s)\n", (char *)data); | ||
643 | else | ||
644 | printf("(VETH_INFO_PEER)\n"); | ||
645 | } | ||
646 | else if (type == IFLA_IFNAME) { | ||
647 | printf("(IFLA_IFNAME %s)\n", (char *) data); | ||
648 | } | ||
649 | else if (type == IFLA_NET_NS_PID) { | ||
650 | printf("(IFLA_NET_NS_PID %u)\n", *((unsigned *) data)); | ||
651 | } | ||
652 | else if (type == IFLA_LINKINFO) | ||
653 | printf("(IFLA_LINKINFO)\n"); | ||
654 | else if (type == IFLA_INFO_DATA) | ||
655 | printf("(IFLA_INFO_DATA)\n"); | ||
656 | else | ||
657 | printf("\n"); | ||
658 | |||
659 | int len = RTA_LENGTH(alen); | ||
660 | struct rtattr *rta; | ||
661 | |||
662 | if (NLMSG_ALIGN(n->nlmsg_len) + RTA_ALIGN(len) > maxlen) { | ||
663 | fprintf(stderr, "addattr_l ERROR: message exceeded bound of %d\n",maxlen); | ||
664 | return -1; | ||
665 | } | ||
666 | rta = NLMSG_TAIL(n); | ||
667 | rta->rta_type = type; | ||
668 | rta->rta_len = len; | ||
669 | memcpy(RTA_DATA(rta), data, alen); | ||
670 | n->nlmsg_len = NLMSG_ALIGN(n->nlmsg_len) + RTA_ALIGN(len); | ||
671 | return 0; | ||
672 | } | ||
673 | #endif | ||
674 | 638 | ||
639 | #if 0 | ||
675 | int addraw_l(struct nlmsghdr *n, int maxlen, const void *data, int len) | 640 | int addraw_l(struct nlmsghdr *n, int maxlen, const void *data, int len) |
676 | { | 641 | { |
677 | if ((int)(NLMSG_ALIGN(n->nlmsg_len) + NLMSG_ALIGN(len)) > maxlen) { | 642 | if ((int)(NLMSG_ALIGN(n->nlmsg_len) + NLMSG_ALIGN(len)) > maxlen) { |
@@ -802,3 +767,4 @@ int __parse_rtattr_nested_compat(struct rtattr *tb[], int max, struct rtattr *rt | |||
802 | memset(tb, 0, sizeof(struct rtattr *) * (max + 1)); | 767 | memset(tb, 0, sizeof(struct rtattr *) * (max + 1)); |
803 | return 0; | 768 | return 0; |
804 | } | 769 | } |
770 | #endif | ||