Lines Matching refs:sock
52 int sock; /* raw packet socket for driver access */
85 static int wired_multicast_membership(int sock, int ifindex,
91 if (sock < 0)
100 if (setsockopt(sock, SOL_PACKET,
154 static void handle_read(int sock, void *eloop_ctx, void *sock_ctx)
159 len = recv(sock, buf, sizeof(buf), 0);
169 static void handle_dhcp(int sock, void *eloop_ctx, void *sock_ctx)
177 len = recv(sock, buf, sizeof(buf), 0);
210 drv->sock = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_PAE));
211 if (drv->sock < 0) {
216 if (eloop_register_read_sock(drv->sock, handle_read, drv->ctx, NULL)) {
223 if (ioctl(drv->sock, SIOCGIFINDEX, &ifr) != 0) {
234 if (bind(drv->sock, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
240 if (wired_multicast_membership(drv->sock, ifr.ifr_ifindex,
249 if (ioctl(drv->sock, SIOCGIFHWADDR, &ifr) != 0) {
336 res = send(drv->sock, (u8 *) hdr, len, 0);
377 if (drv->sock >= 0)
378 close(drv->sock);