4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
9 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
17 #include <sys/ioctl.h>
18 #include <sys/socket.h>
19 #include <sys/ioctl.h>
20 #include <netinet/in.h>
21 #include <arpa/inet.h>
24 #include <linux/netdevice.h>
25 #include <linux/if_arp.h>
26 #include <linux/sockios.h>
32 #define __PF(f,n) { ETH_P_##f, #n },
49 #ifdef ETH_P_IEEEPUPAT
50 __PF(IEEEPUPAT,ieeepupat)
66 __PF(PPP_DISC,ppp_disc)
86 __PF(LOCALTALK,localtalk)
89 __PF(TR_802_2,tr_802_2)
100 { ETH_P_IP, "ipv4" },
105 const char * ll_proto_n2a(unsigned short id, char *buf, int len)
111 for (i=0; i<sizeof(llproto_names)/sizeof(llproto_names[0]); i++) {
112 if (llproto_names[i].id == id)
113 return llproto_names[i].name;
115 snprintf(buf, len, "[%d]", id);
119 int ll_proto_a2n(unsigned short *id, char *buf)
122 for (i=0; i<sizeof(llproto_names)/sizeof(llproto_names[0]); i++) {
123 if (strcasecmp(llproto_names[i].name, buf) == 0) {
124 *id = htons(llproto_names[i].id);
128 if (get_u16(id, buf, 0))