Lines Matching defs:netlink
2 * Netlink helper functions for driver wrappers
20 #include "netlink.h"
29 static void netlink_receive_link(struct netlink_data *netlink,
36 cb(netlink->cfg->ctx, NLMSG_DATA(h),
44 struct netlink_data *netlink = eloop_ctx;
58 wpa_printf(MSG_INFO, "netlink: recvfrom failed: %s",
67 netlink_receive_link(netlink, netlink->cfg->newlink_cb,
71 netlink_receive_link(netlink, netlink->cfg->dellink_cb,
80 wpa_printf(MSG_DEBUG, "netlink: %d extra bytes in the end of "
81 "netlink message", left);
99 struct netlink_data *netlink;
102 netlink = os_zalloc(sizeof(*netlink));
103 if (netlink == NULL)
106 netlink->cfg = cfg;
108 netlink->sock = socket(PF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
109 if (netlink->sock < 0) {
110 wpa_printf(MSG_ERROR, "netlink: Failed to open netlink "
112 netlink_deinit(netlink);
119 if (bind(netlink->sock, (struct sockaddr *) &local, sizeof(local)) < 0)
121 wpa_printf(MSG_ERROR, "netlink: Failed to bind netlink "
123 netlink_deinit(netlink);
127 eloop_register_read_sock(netlink->sock, netlink_receive, netlink,
130 return netlink;
134 void netlink_deinit(struct netlink_data *netlink)
136 if (netlink == NULL)
138 if (netlink->sock >= 0) {
139 eloop_unregister_read_sock(netlink->sock);
140 close(netlink->sock);
142 os_free(netlink->cfg);
143 os_free(netlink);
146 int netlink_send_oper_ifla(struct netlink_data *netlink, int ifindex,
193 wpa_printf(MSG_DEBUG, "netlink: Operstate: linkmode=%d, operstate=%d",
196 ret = send(netlink->sock, &req, req.hdr.nlmsg_len, 0);
198 wpa_printf(MSG_DEBUG, "netlink: Sending operstate IFLA "