• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/router/wpa_supplicant-0.7.3/src/l2_packet/

Lines Matching defs:l2

38 int l2_packet_get_own_addr(struct l2_packet_data *l2, u8 *addr)
40 os_memcpy(addr, l2->own_addr, ETH_ALEN);
45 int l2_packet_send(struct l2_packet_data *l2, const u8 *dst_addr, u16 proto,
49 if (l2 == NULL)
51 if (l2->l2_hdr) {
52 ret = send(l2->fd, buf, len, 0);
59 ll.sll_ifindex = l2->ifindex;
63 ret = sendto(l2->fd, buf, len, 0, (struct sockaddr *) &ll,
74 struct l2_packet_data *l2 = eloop_ctx;
89 l2->rx_callback(l2->rx_callback_ctx, ll.sll_addr, buf, res);
99 struct l2_packet_data *l2;
103 l2 = os_zalloc(sizeof(struct l2_packet_data));
104 if (l2 == NULL)
106 os_strlcpy(l2->ifname, ifname, sizeof(l2->ifname));
107 l2->rx_callback = rx_callback;
108 l2->rx_callback_ctx = rx_callback_ctx;
109 l2->l2_hdr = l2_hdr;
111 l2->fd = socket(PF_PACKET, l2_hdr ? SOCK_RAW : SOCK_DGRAM,
113 if (l2->fd < 0) {
115 os_free(l2);
119 os_strlcpy(ifr.ifr_name, l2->ifname, sizeof(ifr.ifr_name));
120 if (ioctl(l2->fd, SIOCGIFINDEX, &ifr) < 0) {
122 close(l2->fd);
123 os_free(l2);
126 l2->ifindex = ifr.ifr_ifindex;
132 if (bind(l2->fd, (struct sockaddr *) &ll, sizeof(ll)) < 0) {
134 close(l2->fd);
135 os_free(l2);
139 if (ioctl(l2->fd, SIOCGIFHWADDR, &ifr) < 0) {
141 close(l2->fd);
142 os_free(l2);
145 os_memcpy(l2->own_addr, ifr.ifr_hwaddr.sa_data, ETH_ALEN);
147 eloop_register_read_sock(l2->fd, l2_packet_receive, l2, NULL);
149 return l2;
153 void l2_packet_deinit(struct l2_packet_data *l2)
155 if (l2 == NULL)
158 if (l2->fd >= 0) {
159 eloop_unregister_read_sock(l2->fd);
160 close(l2->fd);
163 os_free(l2);
167 int l2_packet_get_ip_addr(struct l2_packet_data *l2, char *buf, size_t len)
180 os_strlcpy(ifr.ifr_name, l2->ifname, sizeof(ifr.ifr_name));
198 void l2_packet_notify_auth_start(struct l2_packet_data *l2)