5 * Copyright (C) 2007-2009 Intel Corporation. All rights reserved.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 #include <sys/socket.h>
29 #include <arpa/inet.h>
30 #include <netinet/ether.h>
31 #include <net/if_arp.h>
33 #include <linux/netlink.h>
34 #include <linux/rtnetlink.h>
40 #define print(arg...) do { } while (0)
41 //#define print(arg...) connman_info(arg)
46 connman_rtnl_operstate_cb_t operstate;
47 connman_rtnl_link_cb_t newlink;
51 static GSList *watch_list = NULL;
52 static unsigned int watch_id = 0;
55 * connman_rtnl_add_operstate_watch:
56 * @index: network device index
57 * @callback: callback function
58 * @user_data: callback data;
60 * Add a new RTNL watch for operation state events
62 * Returns: %0 on failure and a unique id on success
64 unsigned int connman_rtnl_add_operstate_watch(int index,
65 connman_rtnl_operstate_cb_t callback, void *user_data)
67 struct watch_data *watch;
69 watch = g_try_new0(struct watch_data, 1);
73 watch->id = ++watch_id;
76 watch->operstate = callback;
77 watch->user_data = user_data;
79 watch_list = g_slist_prepend(watch_list, watch);
81 DBG("id %d", watch->id);
84 unsigned char operstate = 0;
87 callback(operstate, user_data);
94 * connman_rtnl_add_newlink_watch:
95 * @index: network device index
96 * @callback: callback function
97 * @user_data: callback data;
99 * Add a new RTNL watch for newlink events
101 * Returns: %0 on failure and a unique id on success
103 unsigned int connman_rtnl_add_newlink_watch(int index,
104 connman_rtnl_link_cb_t callback, void *user_data)
106 struct watch_data *watch;
108 watch = g_try_new0(struct watch_data, 1);
112 watch->id = ++watch_id;
113 watch->index = index;
115 watch->newlink = callback;
116 watch->user_data = user_data;
118 watch_list = g_slist_prepend(watch_list, watch);
120 DBG("id %d", watch->id);
123 unsigned int flags = __connman_ipconfig_get_flags(index);
126 callback(flags, 0, user_data);
133 * connman_rtnl_remove_watch:
134 * @id: watch identifier
136 * Remove the RTNL watch for the identifier
138 void connman_rtnl_remove_watch(unsigned int id)
147 for (list = watch_list; list; list = list->next) {
148 struct watch_data *watch = list->data;
150 if (watch->id == id) {
151 watch_list = g_slist_remove(watch_list, watch);
158 static void trigger_rtnl(int index, void *user_data)
160 struct connman_rtnl *rtnl = user_data;
163 unsigned short type = __connman_ipconfig_get_type(index);
164 unsigned int flags = __connman_ipconfig_get_flags(index);
166 rtnl->newlink(type, index, flags, 0);
169 if (rtnl->newgateway) {
170 const char *gateway = __connman_ipconfig_get_gateway(index);
173 rtnl->newgateway(index, gateway);
177 static GSList *rtnl_list = NULL;
179 static gint compare_priority(gconstpointer a, gconstpointer b)
181 const struct connman_rtnl *rtnl1 = a;
182 const struct connman_rtnl *rtnl2 = b;
184 return rtnl2->priority - rtnl1->priority;
188 * connman_rtnl_register:
191 * Register a new RTNL module
193 * Returns: %0 on success
195 int connman_rtnl_register(struct connman_rtnl *rtnl)
197 DBG("rtnl %p name %s", rtnl, rtnl->name);
199 rtnl_list = g_slist_insert_sorted(rtnl_list, rtnl,
202 __connman_ipconfig_foreach(trigger_rtnl, rtnl);
208 * connman_rtnl_unregister:
211 * Remove a previously registered RTNL module
213 void connman_rtnl_unregister(struct connman_rtnl *rtnl)
215 DBG("rtnl %p name %s", rtnl, rtnl->name);
217 rtnl_list = g_slist_remove(rtnl_list, rtnl);
220 static const char *operstate2str(unsigned char operstate)
223 case IF_OPER_UNKNOWN:
225 case IF_OPER_NOTPRESENT:
226 return "NOT-PRESENT";
229 case IF_OPER_LOWERLAYERDOWN:
230 return "LOWER-LAYER-DOWN";
231 case IF_OPER_TESTING:
233 case IF_OPER_DORMANT:
242 static void extract_link(struct ifinfomsg *msg, int bytes,
243 struct ether_addr *address, const char **ifname,
244 unsigned int *mtu, unsigned char *operstate)
246 struct rtnl_link_stats stats;
249 for (attr = IFLA_RTA(msg); RTA_OK(attr, bytes);
250 attr = RTA_NEXT(attr, bytes)) {
251 switch (attr->rta_type) {
254 memcpy(address, RTA_DATA(attr), ETH_ALEN);
258 *ifname = RTA_DATA(attr);
262 *mtu = *((unsigned int *) RTA_DATA(attr));
265 memcpy(&stats, RTA_DATA(attr),
266 sizeof(struct rtnl_link_stats));
267 connman_info("%s {RX} %d packets %d bytes", *ifname,
268 stats.rx_packets, stats.rx_bytes);
269 connman_info("%s {TX} %d packets %d bytes", *ifname,
270 stats.tx_packets, stats.tx_bytes);
273 if (operstate != NULL)
274 *operstate = *((unsigned char *) RTA_DATA(attr));
282 static void process_newlink(unsigned short type, int index, unsigned flags,
283 unsigned change, struct ifinfomsg *msg, int bytes)
285 struct ether_addr address;
286 unsigned char operstate = 0xff;
287 const char *ifname = NULL;
288 unsigned int mtu = 0;
291 memset(&address, 0, ETH_ALEN);
292 extract_link(msg, bytes, &address, &ifname, &mtu, &operstate);
296 case ARPHRD_LOOPBACK:
298 __connman_ipconfig_newlink(index, type, flags,
299 ether_ntoa(&address), mtu);
303 connman_info("%s {newlink} index %d address %s mtu %u",
304 ifname, index, ether_ntoa(&address), mtu);
306 if (operstate != 0xff)
307 connman_info("%s {newlink} index %d operstate %u <%s>",
308 ifname, index, operstate,
309 operstate2str(operstate));
311 for (list = rtnl_list; list; list = list->next) {
312 struct connman_rtnl *rtnl = list->data;
315 rtnl->newlink(type, index, flags, change);
318 for (list = watch_list; list; list = list->next) {
319 struct watch_data *watch = list->data;
321 if (watch->index != index)
324 if (operstate != 0xff && watch->operstate)
325 watch->operstate(operstate, watch->user_data);
328 watch->newlink(flags, change, watch->user_data);
332 static void process_dellink(unsigned short type, int index, unsigned flags,
333 unsigned change, struct ifinfomsg *msg, int bytes)
335 unsigned char operstate = 0xff;
336 const char *ifname = NULL;
339 extract_link(msg, bytes, NULL, &ifname, NULL, &operstate);
341 if (operstate != 0xff)
342 connman_info("%s {dellink} index %d operstate %u <%s>",
343 ifname, index, operstate,
344 operstate2str(operstate));
346 for (list = watch_list; list; list = list->next) {
347 struct watch_data *watch = list->data;
349 if (watch->index != index)
352 if (operstate != 0xff && watch->operstate)
353 watch->operstate(operstate, watch->user_data);
356 for (list = rtnl_list; list; list = list->next) {
357 struct connman_rtnl *rtnl = list->data;
360 rtnl->dellink(type, index, flags, change);
365 case ARPHRD_LOOPBACK:
367 __connman_ipconfig_dellink(index);
372 static void extract_addr(struct ifaddrmsg *msg, int bytes,
374 struct in_addr *local,
375 struct in_addr *address,
376 struct in_addr *broadcast)
380 for (attr = IFA_RTA(msg); RTA_OK(attr, bytes);
381 attr = RTA_NEXT(attr, bytes)) {
382 switch (attr->rta_type) {
385 *address = *((struct in_addr *) RTA_DATA(attr));
389 *local = *((struct in_addr *) RTA_DATA(attr));
392 if (broadcast != NULL)
393 *broadcast = *((struct in_addr *) RTA_DATA(attr));
397 *label = RTA_DATA(attr);
403 static void process_newaddr(unsigned char family, unsigned char prefixlen,
404 int index, struct ifaddrmsg *msg, int bytes)
406 struct in_addr address = { INADDR_ANY };
407 const char *label = NULL;
409 if (family != AF_INET)
412 extract_addr(msg, bytes, &label, &address, NULL, NULL);
414 __connman_ipconfig_newaddr(index, label,
415 prefixlen, inet_ntoa(address));
418 static void process_deladdr(unsigned char family, unsigned char prefixlen,
419 int index, struct ifaddrmsg *msg, int bytes)
421 struct in_addr address = { INADDR_ANY };
422 const char *label = NULL;
424 if (family != AF_INET)
427 extract_addr(msg, bytes, &label, &address, NULL, NULL);
429 __connman_ipconfig_deladdr(index, label,
430 prefixlen, inet_ntoa(address));
433 static void extract_route(struct rtmsg *msg, int bytes, int *index,
435 struct in_addr *gateway)
439 for (attr = RTM_RTA(msg); RTA_OK(attr, bytes);
440 attr = RTA_NEXT(attr, bytes)) {
441 switch (attr->rta_type) {
444 *dst = *((struct in_addr *) RTA_DATA(attr));
448 *gateway = *((struct in_addr *) RTA_DATA(attr));
452 *index = *((int *) RTA_DATA(attr));
458 static void process_newroute(unsigned char family, unsigned char scope,
459 struct rtmsg *msg, int bytes)
462 struct in_addr dst = { INADDR_ANY }, gateway = { INADDR_ANY };
463 char dststr[16], gatewaystr[16];
466 if (family != AF_INET)
469 extract_route(msg, bytes, &index, &dst, &gateway);
471 inet_ntop(family, &dst, dststr, sizeof(dststr));
472 inet_ntop(family, &gateway, gatewaystr, sizeof(gatewaystr));
474 __connman_ipconfig_newroute(index, scope, dststr, gatewaystr);
476 if (scope != RT_SCOPE_UNIVERSE || dst.s_addr != INADDR_ANY)
479 for (list = rtnl_list; list; list = list->next) {
480 struct connman_rtnl *rtnl = list->data;
482 if (rtnl->newgateway)
483 rtnl->newgateway(index, gatewaystr);
487 static void process_delroute(unsigned char family, unsigned char scope,
488 struct rtmsg *msg, int bytes)
491 struct in_addr dst = { INADDR_ANY }, gateway = { INADDR_ANY };
492 char dststr[16], gatewaystr[16];
495 if (family != AF_INET)
498 extract_route(msg, bytes, &index, &dst, &gateway);
500 inet_ntop(family, &dst, dststr, sizeof(dststr));
501 inet_ntop(family, &gateway, gatewaystr, sizeof(gatewaystr));
503 __connman_ipconfig_delroute(index, scope, dststr, gatewaystr);
505 if (scope != RT_SCOPE_UNIVERSE || dst.s_addr != INADDR_ANY)
508 for (list = rtnl_list; list; list = list->next) {
509 struct connman_rtnl *rtnl = list->data;
511 if (rtnl->delgateway)
512 rtnl->delgateway(index, gatewaystr);
516 static inline void print_ether(struct rtattr *attr, const char *name)
518 int len = (int) RTA_PAYLOAD(attr);
520 if (len == ETH_ALEN) {
521 struct ether_addr eth;
522 memcpy(ð, RTA_DATA(attr), ETH_ALEN);
523 print(" attr %s (len %d) %s\n", name, len, ether_ntoa(ð));
525 print(" attr %s (len %d)\n", name, len);
528 static inline void print_inet(struct rtattr *attr, const char *name,
529 unsigned char family)
531 int len = (int) RTA_PAYLOAD(attr);
533 if (family == AF_INET && len == sizeof(struct in_addr)) {
535 addr = *((struct in_addr *) RTA_DATA(attr));
536 print(" attr %s (len %d) %s\n", name, len, inet_ntoa(addr));
538 print(" attr %s (len %d)\n", name, len);
541 static inline void print_string(struct rtattr *attr, const char *name)
543 print(" attr %s (len %d) %s\n", name, (int) RTA_PAYLOAD(attr),
544 (char *) RTA_DATA(attr));
547 static inline void print_byte(struct rtattr *attr, const char *name)
549 print(" attr %s (len %d) 0x%02x\n", name, (int) RTA_PAYLOAD(attr),
550 *((unsigned char *) RTA_DATA(attr)));
553 static inline void print_integer(struct rtattr *attr, const char *name)
555 print(" attr %s (len %d) %d\n", name, (int) RTA_PAYLOAD(attr),
556 *((int *) RTA_DATA(attr)));
559 static inline void print_attr(struct rtattr *attr, const char *name)
561 int len = (int) RTA_PAYLOAD(attr);
564 print(" attr %s (len %d)\n", name, len);
566 print(" attr %d (len %d)\n", attr->rta_type, len);
569 static void rtnl_link(struct nlmsghdr *hdr)
571 struct ifinfomsg *msg;
575 msg = (struct ifinfomsg *) NLMSG_DATA(hdr);
576 bytes = IFLA_PAYLOAD(hdr);
578 print("ifi_index %d ifi_flags 0x%04x", msg->ifi_index, msg->ifi_flags);
580 for (attr = IFLA_RTA(msg); RTA_OK(attr, bytes);
581 attr = RTA_NEXT(attr, bytes)) {
582 switch (attr->rta_type) {
584 print_ether(attr, "address");
587 print_ether(attr, "broadcast");
590 print_string(attr, "ifname");
593 print_integer(attr, "mtu");
596 print_attr(attr, "link");
599 print_attr(attr, "qdisc");
602 print_attr(attr, "stats");
605 print_attr(attr, "cost");
608 print_attr(attr, "priority");
611 print_attr(attr, "master");
614 print_attr(attr, "wireless");
617 print_attr(attr, "protinfo");
620 print_integer(attr, "txqlen");
623 print_attr(attr, "map");
626 print_attr(attr, "weight");
629 print_byte(attr, "operstate");
632 print_byte(attr, "linkmode");
635 print_attr(attr, NULL);
641 static void rtnl_newlink(struct nlmsghdr *hdr)
643 struct ifinfomsg *msg = (struct ifinfomsg *) NLMSG_DATA(hdr);
647 process_newlink(msg->ifi_type, msg->ifi_index, msg->ifi_flags,
648 msg->ifi_change, msg, IFA_PAYLOAD(hdr));
651 static void rtnl_dellink(struct nlmsghdr *hdr)
653 struct ifinfomsg *msg = (struct ifinfomsg *) NLMSG_DATA(hdr);
657 process_dellink(msg->ifi_type, msg->ifi_index, msg->ifi_flags,
658 msg->ifi_change, msg, IFA_PAYLOAD(hdr));
661 static void rtnl_addr(struct nlmsghdr *hdr)
663 struct ifaddrmsg *msg;
667 msg = (struct ifaddrmsg *) NLMSG_DATA(hdr);
668 bytes = IFA_PAYLOAD(hdr);
670 print("ifa_family %d ifa_index %d", msg->ifa_family, msg->ifa_index);
672 for (attr = IFA_RTA(msg); RTA_OK(attr, bytes);
673 attr = RTA_NEXT(attr, bytes)) {
674 switch (attr->rta_type) {
676 print_inet(attr, "address", msg->ifa_family);
679 print_inet(attr, "local", msg->ifa_family);
682 print_string(attr, "label");
685 print_inet(attr, "broadcast", msg->ifa_family);
688 print_attr(attr, "anycast");
691 print_attr(attr, "cacheinfo");
694 print_attr(attr, "multicast");
697 print_attr(attr, NULL);
703 static void rtnl_newaddr(struct nlmsghdr *hdr)
705 struct ifaddrmsg *msg = (struct ifaddrmsg *) NLMSG_DATA(hdr);
709 process_newaddr(msg->ifa_family, msg->ifa_prefixlen, msg->ifa_index,
710 msg, IFA_PAYLOAD(hdr));
713 static void rtnl_deladdr(struct nlmsghdr *hdr)
715 struct ifaddrmsg *msg = (struct ifaddrmsg *) NLMSG_DATA(hdr);
719 process_deladdr(msg->ifa_family, msg->ifa_prefixlen, msg->ifa_index,
720 msg, IFA_PAYLOAD(hdr));
723 static void rtnl_route(struct nlmsghdr *hdr)
729 msg = (struct rtmsg *) NLMSG_DATA(hdr);
730 bytes = RTM_PAYLOAD(hdr);
732 print("rtm_family %d rtm_table %d rtm_protocol %d",
733 msg->rtm_family, msg->rtm_table, msg->rtm_protocol);
734 print("rtm_scope %d rtm_type %d rtm_flags 0x%04x",
735 msg->rtm_scope, msg->rtm_type, msg->rtm_flags);
737 for (attr = RTM_RTA(msg); RTA_OK(attr, bytes);
738 attr = RTA_NEXT(attr, bytes)) {
739 switch (attr->rta_type) {
741 print_inet(attr, "dst", msg->rtm_family);
744 print_inet(attr, "src", msg->rtm_family);
747 print_string(attr, "iif");
750 print_integer(attr, "oif");
753 print_inet(attr, "gateway", msg->rtm_family);
756 print_attr(attr, "priority");
759 print_inet(attr, "prefsrc", msg->rtm_family);
762 print_attr(attr, "metrics");
765 print_integer(attr, "table");
768 print_attr(attr, NULL);
774 static void rtnl_newroute(struct nlmsghdr *hdr)
776 struct rtmsg *msg = (struct rtmsg *) NLMSG_DATA(hdr);
780 if (msg->rtm_table == RT_TABLE_MAIN &&
781 msg->rtm_protocol == RTPROT_BOOT &&
782 msg->rtm_type == RTN_UNICAST)
783 process_newroute(msg->rtm_family, msg->rtm_scope,
784 msg, RTM_PAYLOAD(hdr));
787 static void rtnl_delroute(struct nlmsghdr *hdr)
789 struct rtmsg *msg = (struct rtmsg *) NLMSG_DATA(hdr);
793 if (msg->rtm_table == RT_TABLE_MAIN &&
794 msg->rtm_protocol == RTPROT_BOOT &&
795 msg->rtm_type == RTN_UNICAST)
796 process_delroute(msg->rtm_family, msg->rtm_scope,
797 msg, RTM_PAYLOAD(hdr));
800 static const char *type2string(uint16_t type)
832 static GIOChannel *channel = NULL;
834 struct rtnl_request {
838 #define RTNL_REQUEST_SIZE (sizeof(struct nlmsghdr) + sizeof(struct rtgenmsg))
840 static GSList *request_list = NULL;
841 static guint32 request_seq = 0;
843 static struct rtnl_request *find_request(guint32 seq)
847 for (list = request_list; list; list = list->next) {
848 struct rtnl_request *req = list->data;
850 if (req->hdr.nlmsg_seq == seq)
857 static int send_request(struct rtnl_request *req)
859 struct sockaddr_nl addr;
862 DBG("%s len %d type %d flags 0x%04x seq %d",
863 type2string(req->hdr.nlmsg_type),
864 req->hdr.nlmsg_len, req->hdr.nlmsg_type,
865 req->hdr.nlmsg_flags, req->hdr.nlmsg_seq);
867 sk = g_io_channel_unix_get_fd(channel);
869 memset(&addr, 0, sizeof(addr));
870 addr.nl_family = AF_NETLINK;
872 return sendto(sk, req, req->hdr.nlmsg_len, 0,
873 (struct sockaddr *) &addr, sizeof(addr));
876 static int queue_request(struct rtnl_request *req)
878 request_list = g_slist_append(request_list, req);
880 if (g_slist_length(request_list) > 1)
883 return send_request(req);
886 static int process_response(guint32 seq)
888 struct rtnl_request *req;
892 req = find_request(seq);
894 request_list = g_slist_remove(request_list, req);
898 req = g_slist_nth_data(request_list, 0);
902 return send_request(req);
905 static void rtnl_message(void *buf, size_t len)
907 DBG("buf %p len %zd", buf, len);
910 struct nlmsghdr *hdr = buf;
911 struct nlmsgerr *err;
913 if (!NLMSG_OK(hdr, len))
916 DBG("%s len %d type %d flags 0x%04x seq %d",
917 type2string(hdr->nlmsg_type),
918 hdr->nlmsg_len, hdr->nlmsg_type,
919 hdr->nlmsg_flags, hdr->nlmsg_seq);
921 switch (hdr->nlmsg_type) {
926 process_response(hdr->nlmsg_seq);
929 err = NLMSG_DATA(hdr);
930 DBG("error %d (%s)", -err->error,
931 strerror(-err->error));
953 len -= hdr->nlmsg_len;
954 buf += hdr->nlmsg_len;
958 static gboolean netlink_event(GIOChannel *chan,
959 GIOCondition cond, gpointer data)
961 unsigned char buf[4096];
965 if (cond & (G_IO_NVAL | G_IO_HUP | G_IO_ERR))
968 memset(buf, 0, sizeof(buf));
970 err = g_io_channel_read(chan, (gchar *) buf, sizeof(buf), &len);
972 if (err == G_IO_ERROR_AGAIN)
977 rtnl_message(buf, len);
982 static int send_getlink(void)
984 struct rtnl_request *req;
988 req = g_try_malloc0(RTNL_REQUEST_SIZE);
992 req->hdr.nlmsg_len = RTNL_REQUEST_SIZE;
993 req->hdr.nlmsg_type = RTM_GETLINK;
994 req->hdr.nlmsg_flags = NLM_F_REQUEST | NLM_F_DUMP;
995 req->hdr.nlmsg_pid = 0;
996 req->hdr.nlmsg_seq = request_seq++;
997 req->msg.rtgen_family = AF_INET;
999 return queue_request(req);
1002 static int send_getaddr(void)
1004 struct rtnl_request *req;
1008 req = g_try_malloc0(RTNL_REQUEST_SIZE);
1012 req->hdr.nlmsg_len = RTNL_REQUEST_SIZE;
1013 req->hdr.nlmsg_type = RTM_GETADDR;
1014 req->hdr.nlmsg_flags = NLM_F_REQUEST | NLM_F_DUMP;
1015 req->hdr.nlmsg_pid = 0;
1016 req->hdr.nlmsg_seq = request_seq++;
1017 req->msg.rtgen_family = AF_INET;
1019 return queue_request(req);
1022 static int send_getroute(void)
1024 struct rtnl_request *req;
1028 req = g_try_malloc0(RTNL_REQUEST_SIZE);
1032 req->hdr.nlmsg_len = RTNL_REQUEST_SIZE;
1033 req->hdr.nlmsg_type = RTM_GETROUTE;
1034 req->hdr.nlmsg_flags = NLM_F_REQUEST | NLM_F_DUMP;
1035 req->hdr.nlmsg_pid = 0;
1036 req->hdr.nlmsg_seq = request_seq++;
1037 req->msg.rtgen_family = AF_INET;
1039 return queue_request(req);
1042 int __connman_rtnl_init(void)
1044 struct sockaddr_nl addr;
1049 sk = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE);
1053 memset(&addr, 0, sizeof(addr));
1054 addr.nl_family = AF_NETLINK;
1055 addr.nl_groups = RTMGRP_LINK | RTMGRP_IPV4_IFADDR | RTMGRP_IPV4_ROUTE;
1057 if (bind(sk, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
1062 channel = g_io_channel_unix_new(sk);
1063 g_io_channel_set_close_on_unref(channel, TRUE);
1065 g_io_add_watch(channel, G_IO_IN | G_IO_NVAL | G_IO_HUP | G_IO_ERR,
1066 netlink_event, NULL);
1071 void __connman_rtnl_start(void)
1080 void __connman_rtnl_cleanup(void)
1086 for (list = watch_list; list; list = list->next) {
1087 struct watch_data *watch = list->data;
1089 DBG("removing watch %d", watch->id);
1095 g_slist_free(watch_list);
1098 for (list = request_list; list; list = list->next) {
1099 struct rtnl_request *req = list->data;
1101 DBG("%s len %d type %d flags 0x%04x seq %d",
1102 type2string(req->hdr.nlmsg_type),
1103 req->hdr.nlmsg_len, req->hdr.nlmsg_type,
1104 req->hdr.nlmsg_flags, req->hdr.nlmsg_seq);
1110 g_slist_free(request_list);
1111 request_list = NULL;
1113 g_io_channel_shutdown(channel, TRUE, NULL);
1114 g_io_channel_unref(channel);