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 const char **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 *address = RTA_DATA(attr);
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 const char *address = NULL;
286 const char *ifname = NULL;
287 unsigned int mtu = 0;
288 unsigned char operstate = 0xff;
291 extract_link(msg, bytes, &address, &ifname, &mtu, &operstate);
295 case ARPHRD_LOOPBACK:
297 __connman_ipconfig_newlink(index, type, flags, address, mtu);
301 if (address != NULL && strlen(address) > 0)
302 connman_info("%s {newlink} index %d address %s mtu %u",
303 ifname, index, address, mtu);
305 if (operstate != 0xff)
306 connman_info("%s {newlink} index %d operstate %u <%s>",
307 ifname, index, operstate,
308 operstate2str(operstate));
310 for (list = rtnl_list; list; list = list->next) {
311 struct connman_rtnl *rtnl = list->data;
314 rtnl->newlink(type, index, flags, change);
317 for (list = watch_list; list; list = list->next) {
318 struct watch_data *watch = list->data;
320 if (watch->index != index)
323 if (operstate != 0xff && watch->operstate)
324 watch->operstate(operstate, watch->user_data);
327 watch->newlink(flags, change, watch->user_data);
331 static void process_dellink(unsigned short type, int index, unsigned flags,
332 unsigned change, struct ifinfomsg *msg, int bytes)
334 const char *address = NULL;
335 const char *ifname = NULL;
336 unsigned int mtu = 0;
337 unsigned char operstate = 0xff;
340 extract_link(msg, bytes, &address, &ifname, &mtu, &operstate);
342 if (operstate != 0xff)
343 connman_info("%s {dellink} index %d operstate %u <%s>",
344 ifname, index, operstate,
345 operstate2str(operstate));
347 for (list = watch_list; list; list = list->next) {
348 struct watch_data *watch = list->data;
350 if (watch->index != index)
353 if (operstate != 0xff && watch->operstate)
354 watch->operstate(operstate, watch->user_data);
357 for (list = rtnl_list; list; list = list->next) {
358 struct connman_rtnl *rtnl = list->data;
361 rtnl->dellink(type, index, flags, change);
366 case ARPHRD_LOOPBACK:
368 __connman_ipconfig_dellink(index);
373 static void extract_addr(struct ifaddrmsg *msg, int bytes,
375 struct in_addr *local,
376 struct in_addr *address,
377 struct in_addr *broadcast)
381 for (attr = IFA_RTA(msg); RTA_OK(attr, bytes);
382 attr = RTA_NEXT(attr, bytes)) {
383 switch (attr->rta_type) {
386 *address = *((struct in_addr *) RTA_DATA(attr));
390 *local = *((struct in_addr *) RTA_DATA(attr));
393 if (broadcast != NULL)
394 *broadcast = *((struct in_addr *) RTA_DATA(attr));
398 *label = RTA_DATA(attr);
404 static void process_newaddr(unsigned char family, unsigned char prefixlen,
405 int index, struct ifaddrmsg *msg, int bytes)
407 struct in_addr address = { INADDR_ANY };
408 const char *label = NULL;
410 if (family != AF_INET)
413 extract_addr(msg, bytes, &label, &address, NULL, NULL);
415 __connman_ipconfig_newaddr(index, label,
416 prefixlen, inet_ntoa(address));
419 static void process_deladdr(unsigned char family, unsigned char prefixlen,
420 int index, struct ifaddrmsg *msg, int bytes)
422 struct in_addr address = { INADDR_ANY };
423 const char *label = NULL;
425 if (family != AF_INET)
428 extract_addr(msg, bytes, &label, &address, NULL, NULL);
430 __connman_ipconfig_deladdr(index, label,
431 prefixlen, inet_ntoa(address));
434 static void extract_route(struct rtmsg *msg, int bytes, int *index,
436 struct in_addr *gateway)
440 for (attr = RTM_RTA(msg); RTA_OK(attr, bytes);
441 attr = RTA_NEXT(attr, bytes)) {
442 switch (attr->rta_type) {
445 *dst = *((struct in_addr *) RTA_DATA(attr));
449 *gateway = *((struct in_addr *) RTA_DATA(attr));
453 *index = *((int *) RTA_DATA(attr));
459 static void process_newroute(unsigned char family, unsigned char scope,
460 struct rtmsg *msg, int bytes)
463 struct in_addr dst = { INADDR_ANY }, gateway = { INADDR_ANY };
464 char dststr[16], gatewaystr[16];
467 if (family != AF_INET)
470 extract_route(msg, bytes, &index, &dst, &gateway);
472 inet_ntop(family, &dst, dststr, sizeof(dststr));
473 inet_ntop(family, &gateway, gatewaystr, sizeof(gatewaystr));
475 __connman_ipconfig_newroute(index, scope, dststr, gatewaystr);
477 if (scope != RT_SCOPE_UNIVERSE || dst.s_addr != INADDR_ANY)
480 for (list = rtnl_list; list; list = list->next) {
481 struct connman_rtnl *rtnl = list->data;
483 if (rtnl->newgateway)
484 rtnl->newgateway(index, gatewaystr);
488 static void process_delroute(unsigned char family, unsigned char scope,
489 struct rtmsg *msg, int bytes)
492 struct in_addr dst = { INADDR_ANY }, gateway = { INADDR_ANY };
493 char dststr[16], gatewaystr[16];
496 if (family != AF_INET)
499 extract_route(msg, bytes, &index, &dst, &gateway);
501 inet_ntop(family, &dst, dststr, sizeof(dststr));
502 inet_ntop(family, &gateway, gatewaystr, sizeof(gatewaystr));
504 __connman_ipconfig_delroute(index, scope, dststr, gatewaystr);
506 if (scope != RT_SCOPE_UNIVERSE || dst.s_addr != INADDR_ANY)
509 for (list = rtnl_list; list; list = list->next) {
510 struct connman_rtnl *rtnl = list->data;
512 if (rtnl->delgateway)
513 rtnl->delgateway(index, gatewaystr);
517 static inline void print_ether(struct rtattr *attr, const char *name)
519 int len = (int) RTA_PAYLOAD(attr);
521 if (len == ETH_ALEN) {
522 struct ether_addr eth;
523 memcpy(ð, RTA_DATA(attr), ETH_ALEN);
524 print(" attr %s (len %d) %s\n", name, len, ether_ntoa(ð));
526 print(" attr %s (len %d)\n", name, len);
529 static inline void print_inet(struct rtattr *attr, const char *name,
530 unsigned char family)
532 int len = (int) RTA_PAYLOAD(attr);
534 if (family == AF_INET && len == sizeof(struct in_addr)) {
536 addr = *((struct in_addr *) RTA_DATA(attr));
537 print(" attr %s (len %d) %s\n", name, len, inet_ntoa(addr));
539 print(" attr %s (len %d)\n", name, len);
542 static inline void print_string(struct rtattr *attr, const char *name)
544 print(" attr %s (len %d) %s\n", name, (int) RTA_PAYLOAD(attr),
545 (char *) RTA_DATA(attr));
548 static inline void print_byte(struct rtattr *attr, const char *name)
550 print(" attr %s (len %d) 0x%02x\n", name, (int) RTA_PAYLOAD(attr),
551 *((unsigned char *) RTA_DATA(attr)));
554 static inline void print_integer(struct rtattr *attr, const char *name)
556 print(" attr %s (len %d) %d\n", name, (int) RTA_PAYLOAD(attr),
557 *((int *) RTA_DATA(attr)));
560 static inline void print_attr(struct rtattr *attr, const char *name)
562 int len = (int) RTA_PAYLOAD(attr);
565 print(" attr %s (len %d)\n", name, len);
567 print(" attr %d (len %d)\n", attr->rta_type, len);
570 static void rtnl_link(struct nlmsghdr *hdr)
572 struct ifinfomsg *msg;
576 msg = (struct ifinfomsg *) NLMSG_DATA(hdr);
577 bytes = IFLA_PAYLOAD(hdr);
579 print("ifi_index %d ifi_flags 0x%04x", msg->ifi_index, msg->ifi_flags);
581 for (attr = IFLA_RTA(msg); RTA_OK(attr, bytes);
582 attr = RTA_NEXT(attr, bytes)) {
583 switch (attr->rta_type) {
585 print_ether(attr, "address");
588 print_ether(attr, "broadcast");
591 print_string(attr, "ifname");
594 print_integer(attr, "mtu");
597 print_attr(attr, "link");
600 print_attr(attr, "qdisc");
603 print_attr(attr, "stats");
606 print_attr(attr, "cost");
609 print_attr(attr, "priority");
612 print_attr(attr, "master");
615 print_attr(attr, "wireless");
618 print_attr(attr, "protinfo");
621 print_integer(attr, "txqlen");
624 print_attr(attr, "map");
627 print_attr(attr, "weight");
630 print_byte(attr, "operstate");
633 print_byte(attr, "linkmode");
636 print_attr(attr, NULL);
642 static void rtnl_newlink(struct nlmsghdr *hdr)
644 struct ifinfomsg *msg = (struct ifinfomsg *) NLMSG_DATA(hdr);
648 process_newlink(msg->ifi_type, msg->ifi_index, msg->ifi_flags,
649 msg->ifi_change, msg, IFA_PAYLOAD(hdr));
652 static void rtnl_dellink(struct nlmsghdr *hdr)
654 struct ifinfomsg *msg = (struct ifinfomsg *) NLMSG_DATA(hdr);
658 process_dellink(msg->ifi_type, msg->ifi_index, msg->ifi_flags,
659 msg->ifi_change, msg, IFA_PAYLOAD(hdr));
662 static void rtnl_addr(struct nlmsghdr *hdr)
664 struct ifaddrmsg *msg;
668 msg = (struct ifaddrmsg *) NLMSG_DATA(hdr);
669 bytes = IFA_PAYLOAD(hdr);
671 print("ifa_family %d ifa_index %d", msg->ifa_family, msg->ifa_index);
673 for (attr = IFA_RTA(msg); RTA_OK(attr, bytes);
674 attr = RTA_NEXT(attr, bytes)) {
675 switch (attr->rta_type) {
677 print_inet(attr, "address", msg->ifa_family);
680 print_inet(attr, "local", msg->ifa_family);
683 print_string(attr, "label");
686 print_inet(attr, "broadcast", msg->ifa_family);
689 print_attr(attr, "anycast");
692 print_attr(attr, "cacheinfo");
695 print_attr(attr, "multicast");
698 print_attr(attr, NULL);
704 static void rtnl_newaddr(struct nlmsghdr *hdr)
706 struct ifaddrmsg *msg = (struct ifaddrmsg *) NLMSG_DATA(hdr);
710 process_newaddr(msg->ifa_family, msg->ifa_prefixlen, msg->ifa_index,
711 msg, IFA_PAYLOAD(hdr));
714 static void rtnl_deladdr(struct nlmsghdr *hdr)
716 struct ifaddrmsg *msg = (struct ifaddrmsg *) NLMSG_DATA(hdr);
720 process_deladdr(msg->ifa_family, msg->ifa_prefixlen, msg->ifa_index,
721 msg, IFA_PAYLOAD(hdr));
724 static void rtnl_route(struct nlmsghdr *hdr)
730 msg = (struct rtmsg *) NLMSG_DATA(hdr);
731 bytes = RTM_PAYLOAD(hdr);
733 print("rtm_family %d rtm_table %d rtm_protocol %d",
734 msg->rtm_family, msg->rtm_table, msg->rtm_protocol);
735 print("rtm_scope %d rtm_type %d rtm_flags 0x%04x",
736 msg->rtm_scope, msg->rtm_type, msg->rtm_flags);
738 for (attr = RTM_RTA(msg); RTA_OK(attr, bytes);
739 attr = RTA_NEXT(attr, bytes)) {
740 switch (attr->rta_type) {
742 print_inet(attr, "dst", msg->rtm_family);
745 print_inet(attr, "src", msg->rtm_family);
748 print_string(attr, "iif");
751 print_integer(attr, "oif");
754 print_inet(attr, "gateway", msg->rtm_family);
757 print_attr(attr, "priority");
760 print_inet(attr, "prefsrc", msg->rtm_family);
763 print_attr(attr, "metrics");
766 print_integer(attr, "table");
769 print_attr(attr, NULL);
775 static void rtnl_newroute(struct nlmsghdr *hdr)
777 struct rtmsg *msg = (struct rtmsg *) NLMSG_DATA(hdr);
781 if (msg->rtm_table == RT_TABLE_MAIN &&
782 msg->rtm_protocol == RTPROT_BOOT &&
783 msg->rtm_type == RTN_UNICAST)
784 process_newroute(msg->rtm_family, msg->rtm_scope,
785 msg, RTM_PAYLOAD(hdr));
788 static void rtnl_delroute(struct nlmsghdr *hdr)
790 struct rtmsg *msg = (struct rtmsg *) NLMSG_DATA(hdr);
794 if (msg->rtm_table == RT_TABLE_MAIN &&
795 msg->rtm_protocol == RTPROT_BOOT &&
796 msg->rtm_type == RTN_UNICAST)
797 process_delroute(msg->rtm_family, msg->rtm_scope,
798 msg, RTM_PAYLOAD(hdr));
801 static const char *type2string(uint16_t type)
833 static GIOChannel *channel = NULL;
835 struct rtnl_request {
839 #define RTNL_REQUEST_SIZE (sizeof(struct nlmsghdr) + sizeof(struct rtgenmsg))
841 static GSList *request_list = NULL;
842 static guint32 request_seq = 0;
844 static struct rtnl_request *find_request(guint32 seq)
848 for (list = request_list; list; list = list->next) {
849 struct rtnl_request *req = list->data;
851 if (req->hdr.nlmsg_seq == seq)
858 static int send_request(struct rtnl_request *req)
860 struct sockaddr_nl addr;
863 DBG("%s len %d type %d flags 0x%04x seq %d",
864 type2string(req->hdr.nlmsg_type),
865 req->hdr.nlmsg_len, req->hdr.nlmsg_type,
866 req->hdr.nlmsg_flags, req->hdr.nlmsg_seq);
868 sk = g_io_channel_unix_get_fd(channel);
870 memset(&addr, 0, sizeof(addr));
871 addr.nl_family = AF_NETLINK;
873 return sendto(sk, req, req->hdr.nlmsg_len, 0,
874 (struct sockaddr *) &addr, sizeof(addr));
877 static int queue_request(struct rtnl_request *req)
879 request_list = g_slist_append(request_list, req);
881 if (g_slist_length(request_list) > 1)
884 return send_request(req);
887 static int process_response(guint32 seq)
889 struct rtnl_request *req;
893 req = find_request(seq);
895 request_list = g_slist_remove(request_list, req);
899 req = g_slist_nth_data(request_list, 0);
903 return send_request(req);
906 static void rtnl_message(void *buf, size_t len)
908 DBG("buf %p len %zd", buf, len);
911 struct nlmsghdr *hdr = buf;
912 struct nlmsgerr *err;
914 if (!NLMSG_OK(hdr, len))
917 DBG("%s len %d type %d flags 0x%04x seq %d",
918 type2string(hdr->nlmsg_type),
919 hdr->nlmsg_len, hdr->nlmsg_type,
920 hdr->nlmsg_flags, hdr->nlmsg_seq);
922 switch (hdr->nlmsg_type) {
927 process_response(hdr->nlmsg_seq);
930 err = NLMSG_DATA(hdr);
931 DBG("error %d (%s)", -err->error,
932 strerror(-err->error));
954 len -= hdr->nlmsg_len;
955 buf += hdr->nlmsg_len;
959 static gboolean netlink_event(GIOChannel *chan,
960 GIOCondition cond, gpointer data)
962 unsigned char buf[4096];
966 if (cond & (G_IO_NVAL | G_IO_HUP | G_IO_ERR))
969 memset(buf, 0, sizeof(buf));
971 err = g_io_channel_read(chan, (gchar *) buf, sizeof(buf), &len);
973 if (err == G_IO_ERROR_AGAIN)
978 rtnl_message(buf, len);
983 static int send_getlink(void)
985 struct rtnl_request *req;
989 req = g_try_malloc0(RTNL_REQUEST_SIZE);
993 req->hdr.nlmsg_len = RTNL_REQUEST_SIZE;
994 req->hdr.nlmsg_type = RTM_GETLINK;
995 req->hdr.nlmsg_flags = NLM_F_REQUEST | NLM_F_DUMP;
996 req->hdr.nlmsg_pid = 0;
997 req->hdr.nlmsg_seq = request_seq++;
998 req->msg.rtgen_family = AF_INET;
1000 return queue_request(req);
1003 static int send_getaddr(void)
1005 struct rtnl_request *req;
1009 req = g_try_malloc0(RTNL_REQUEST_SIZE);
1013 req->hdr.nlmsg_len = RTNL_REQUEST_SIZE;
1014 req->hdr.nlmsg_type = RTM_GETADDR;
1015 req->hdr.nlmsg_flags = NLM_F_REQUEST | NLM_F_DUMP;
1016 req->hdr.nlmsg_pid = 0;
1017 req->hdr.nlmsg_seq = request_seq++;
1018 req->msg.rtgen_family = AF_INET;
1020 return queue_request(req);
1023 static int send_getroute(void)
1025 struct rtnl_request *req;
1029 req = g_try_malloc0(RTNL_REQUEST_SIZE);
1033 req->hdr.nlmsg_len = RTNL_REQUEST_SIZE;
1034 req->hdr.nlmsg_type = RTM_GETROUTE;
1035 req->hdr.nlmsg_flags = NLM_F_REQUEST | NLM_F_DUMP;
1036 req->hdr.nlmsg_pid = 0;
1037 req->hdr.nlmsg_seq = request_seq++;
1038 req->msg.rtgen_family = AF_INET;
1040 return queue_request(req);
1043 int __connman_rtnl_init(void)
1045 struct sockaddr_nl addr;
1050 sk = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE);
1054 memset(&addr, 0, sizeof(addr));
1055 addr.nl_family = AF_NETLINK;
1056 addr.nl_groups = RTMGRP_LINK | RTMGRP_IPV4_IFADDR | RTMGRP_IPV4_ROUTE;
1058 if (bind(sk, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
1063 channel = g_io_channel_unix_new(sk);
1064 g_io_channel_set_close_on_unref(channel, TRUE);
1066 g_io_add_watch(channel, G_IO_IN | G_IO_NVAL | G_IO_HUP | G_IO_ERR,
1067 netlink_event, NULL);
1072 void __connman_rtnl_start(void)
1081 void __connman_rtnl_cleanup(void)
1087 for (list = watch_list; list; list = list->next) {
1088 struct watch_data *watch = list->data;
1090 DBG("removing watch %d", watch->id);
1096 g_slist_free(watch_list);
1099 for (list = request_list; list; list = list->next) {
1100 struct rtnl_request *req = list->data;
1102 DBG("%s len %d type %d flags 0x%04x seq %d",
1103 type2string(req->hdr.nlmsg_type),
1104 req->hdr.nlmsg_len, req->hdr.nlmsg_type,
1105 req->hdr.nlmsg_flags, req->hdr.nlmsg_seq);
1111 g_slist_free(request_list);
1112 request_list = NULL;
1114 g_io_channel_shutdown(channel, TRUE, NULL);
1115 g_io_channel_unref(channel);