Contents of /trunk/mkinitrd-magellan/busybox/networking/libiproute/ll_types.c
Parent Directory | Revision Log
Revision 984 -
(show annotations)
(download)
Sun May 30 11:32:42 2010 UTC (13 years, 11 months ago) by niro
File MIME type: text/plain
File size: 6600 byte(s)
Sun May 30 11:32:42 2010 UTC (13 years, 11 months ago) by niro
File MIME type: text/plain
File size: 6600 byte(s)
-updated to busybox-1.16.1 and enabled blkid/uuid support in default config
1 | /* vi: set sw=4 ts=4: */ |
2 | /* |
3 | * ll_types.c |
4 | * |
5 | * This program is free software; you can redistribute it and/or |
6 | * modify it under the terms of the GNU General Public License |
7 | * as published by the Free Software Foundation; either version |
8 | * 2 of the License, or (at your option) any later version. |
9 | * |
10 | * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> |
11 | */ |
12 | #include <arpa/inet.h> |
13 | #include <linux/if_arp.h> |
14 | |
15 | #include "libbb.h" |
16 | #include "rt_names.h" |
17 | |
18 | const char* FAST_FUNC ll_type_n2a(int type, char *buf) |
19 | { |
20 | static const char arphrd_name[] = |
21 | /* 0, */ "generic" "\0" |
22 | /* ARPHRD_LOOPBACK, */ "loopback" "\0" |
23 | /* ARPHRD_ETHER, */ "ether" "\0" |
24 | #ifdef ARPHRD_INFINIBAND |
25 | /* ARPHRD_INFINIBAND, */ "infiniband" "\0" |
26 | #endif |
27 | #ifdef ARPHRD_IEEE802_TR |
28 | /* ARPHRD_IEEE802, */ "ieee802" "\0" |
29 | /* ARPHRD_IEEE802_TR, */ "tr" "\0" |
30 | #else |
31 | /* ARPHRD_IEEE802, */ "tr" "\0" |
32 | #endif |
33 | #ifdef ARPHRD_IEEE80211 |
34 | /* ARPHRD_IEEE80211, */ "ieee802.11" "\0" |
35 | #endif |
36 | #ifdef ARPHRD_IEEE1394 |
37 | /* ARPHRD_IEEE1394, */ "ieee1394" "\0" |
38 | #endif |
39 | /* ARPHRD_IRDA, */ "irda" "\0" |
40 | /* ARPHRD_SLIP, */ "slip" "\0" |
41 | /* ARPHRD_CSLIP, */ "cslip" "\0" |
42 | /* ARPHRD_SLIP6, */ "slip6" "\0" |
43 | /* ARPHRD_CSLIP6, */ "cslip6" "\0" |
44 | /* ARPHRD_PPP, */ "ppp" "\0" |
45 | /* ARPHRD_TUNNEL, */ "ipip" "\0" |
46 | /* ARPHRD_TUNNEL6, */ "tunnel6" "\0" |
47 | /* ARPHRD_SIT, */ "sit" "\0" |
48 | /* ARPHRD_IPGRE, */ "gre" "\0" |
49 | #ifdef ARPHRD_VOID |
50 | /* ARPHRD_VOID, */ "void" "\0" |
51 | #endif |
52 | |
53 | #if ENABLE_FEATURE_IP_RARE_PROTOCOLS |
54 | /* ARPHRD_EETHER, */ "eether" "\0" |
55 | /* ARPHRD_AX25, */ "ax25" "\0" |
56 | /* ARPHRD_PRONET, */ "pronet" "\0" |
57 | /* ARPHRD_CHAOS, */ "chaos" "\0" |
58 | /* ARPHRD_ARCNET, */ "arcnet" "\0" |
59 | /* ARPHRD_APPLETLK, */ "atalk" "\0" |
60 | /* ARPHRD_DLCI, */ "dlci" "\0" |
61 | #ifdef ARPHRD_ATM |
62 | /* ARPHRD_ATM, */ "atm" "\0" |
63 | #endif |
64 | /* ARPHRD_METRICOM, */ "metricom" "\0" |
65 | /* ARPHRD_RSRVD, */ "rsrvd" "\0" |
66 | /* ARPHRD_ADAPT, */ "adapt" "\0" |
67 | /* ARPHRD_ROSE, */ "rose" "\0" |
68 | /* ARPHRD_X25, */ "x25" "\0" |
69 | #ifdef ARPHRD_HWX25 |
70 | /* ARPHRD_HWX25, */ "hwx25" "\0" |
71 | #endif |
72 | /* ARPHRD_HDLC, */ "hdlc" "\0" |
73 | /* ARPHRD_LAPB, */ "lapb" "\0" |
74 | #ifdef ARPHRD_DDCMP |
75 | /* ARPHRD_DDCMP, */ "ddcmp" "\0" |
76 | /* ARPHRD_RAWHDLC, */ "rawhdlc" "\0" |
77 | #endif |
78 | /* ARPHRD_FRAD, */ "frad" "\0" |
79 | /* ARPHRD_SKIP, */ "skip" "\0" |
80 | /* ARPHRD_LOCALTLK, */ "ltalk" "\0" |
81 | /* ARPHRD_FDDI, */ "fddi" "\0" |
82 | /* ARPHRD_BIF, */ "bif" "\0" |
83 | /* ARPHRD_IPDDP, */ "ip/ddp" "\0" |
84 | /* ARPHRD_PIMREG, */ "pimreg" "\0" |
85 | /* ARPHRD_HIPPI, */ "hippi" "\0" |
86 | /* ARPHRD_ASH, */ "ash" "\0" |
87 | /* ARPHRD_ECONET, */ "econet" "\0" |
88 | /* ARPHRD_FCPP, */ "fcpp" "\0" |
89 | /* ARPHRD_FCAL, */ "fcal" "\0" |
90 | /* ARPHRD_FCPL, */ "fcpl" "\0" |
91 | /* ARPHRD_FCFABRIC, */ "fcfb0" "\0" |
92 | /* ARPHRD_FCFABRIC+1, */ "fcfb1" "\0" |
93 | /* ARPHRD_FCFABRIC+2, */ "fcfb2" "\0" |
94 | /* ARPHRD_FCFABRIC+3, */ "fcfb3" "\0" |
95 | /* ARPHRD_FCFABRIC+4, */ "fcfb4" "\0" |
96 | /* ARPHRD_FCFABRIC+5, */ "fcfb5" "\0" |
97 | /* ARPHRD_FCFABRIC+6, */ "fcfb6" "\0" |
98 | /* ARPHRD_FCFABRIC+7, */ "fcfb7" "\0" |
99 | /* ARPHRD_FCFABRIC+8, */ "fcfb8" "\0" |
100 | /* ARPHRD_FCFABRIC+9, */ "fcfb9" "\0" |
101 | /* ARPHRD_FCFABRIC+10, */ "fcfb10" "\0" |
102 | /* ARPHRD_FCFABRIC+11, */ "fcfb11" "\0" |
103 | /* ARPHRD_FCFABRIC+12, */ "fcfb12" "\0" |
104 | #endif /* FEATURE_IP_RARE_PROTOCOLS */ |
105 | ; |
106 | |
107 | /* Keep these arrays in sync! */ |
108 | |
109 | static const uint16_t arphrd_type[] = { |
110 | 0, /* "generic" "\0" */ |
111 | ARPHRD_LOOPBACK, /* "loopback" "\0" */ |
112 | ARPHRD_ETHER, /* "ether" "\0" */ |
113 | #ifdef ARPHRD_INFINIBAND |
114 | ARPHRD_INFINIBAND, /* "infiniband" "\0" */ |
115 | #endif |
116 | #ifdef ARPHRD_IEEE802_TR |
117 | ARPHRD_IEEE802, /* "ieee802" "\0" */ |
118 | ARPHRD_IEEE802_TR, /* "tr" "\0" */ |
119 | #else |
120 | ARPHRD_IEEE802, /* "tr" "\0" */ |
121 | #endif |
122 | #ifdef ARPHRD_IEEE80211 |
123 | ARPHRD_IEEE80211, /* "ieee802.11" "\0" */ |
124 | #endif |
125 | #ifdef ARPHRD_IEEE1394 |
126 | ARPHRD_IEEE1394, /* "ieee1394" "\0" */ |
127 | #endif |
128 | ARPHRD_IRDA, /* "irda" "\0" */ |
129 | ARPHRD_SLIP, /* "slip" "\0" */ |
130 | ARPHRD_CSLIP, /* "cslip" "\0" */ |
131 | ARPHRD_SLIP6, /* "slip6" "\0" */ |
132 | ARPHRD_CSLIP6, /* "cslip6" "\0" */ |
133 | ARPHRD_PPP, /* "ppp" "\0" */ |
134 | ARPHRD_TUNNEL, /* "ipip" "\0" */ |
135 | ARPHRD_TUNNEL6, /* "tunnel6" "\0" */ |
136 | ARPHRD_SIT, /* "sit" "\0" */ |
137 | ARPHRD_IPGRE, /* "gre" "\0" */ |
138 | #ifdef ARPHRD_VOID |
139 | ARPHRD_VOID, /* "void" "\0" */ |
140 | #endif |
141 | |
142 | #if ENABLE_FEATURE_IP_RARE_PROTOCOLS |
143 | ARPHRD_EETHER, /* "eether" "\0" */ |
144 | ARPHRD_AX25, /* "ax25" "\0" */ |
145 | ARPHRD_PRONET, /* "pronet" "\0" */ |
146 | ARPHRD_CHAOS, /* "chaos" "\0" */ |
147 | ARPHRD_ARCNET, /* "arcnet" "\0" */ |
148 | ARPHRD_APPLETLK, /* "atalk" "\0" */ |
149 | ARPHRD_DLCI, /* "dlci" "\0" */ |
150 | #ifdef ARPHRD_ATM |
151 | ARPHRD_ATM, /* "atm" "\0" */ |
152 | #endif |
153 | ARPHRD_METRICOM, /* "metricom" "\0" */ |
154 | ARPHRD_RSRVD, /* "rsrvd" "\0" */ |
155 | ARPHRD_ADAPT, /* "adapt" "\0" */ |
156 | ARPHRD_ROSE, /* "rose" "\0" */ |
157 | ARPHRD_X25, /* "x25" "\0" */ |
158 | #ifdef ARPHRD_HWX25 |
159 | ARPHRD_HWX25, /* "hwx25" "\0" */ |
160 | #endif |
161 | ARPHRD_HDLC, /* "hdlc" "\0" */ |
162 | ARPHRD_LAPB, /* "lapb" "\0" */ |
163 | #ifdef ARPHRD_DDCMP |
164 | ARPHRD_DDCMP, /* "ddcmp" "\0" */ |
165 | ARPHRD_RAWHDLC, /* "rawhdlc" "\0" */ |
166 | #endif |
167 | ARPHRD_FRAD, /* "frad" "\0" */ |
168 | ARPHRD_SKIP, /* "skip" "\0" */ |
169 | ARPHRD_LOCALTLK, /* "ltalk" "\0" */ |
170 | ARPHRD_FDDI, /* "fddi" "\0" */ |
171 | ARPHRD_BIF, /* "bif" "\0" */ |
172 | ARPHRD_IPDDP, /* "ip/ddp" "\0" */ |
173 | ARPHRD_PIMREG, /* "pimreg" "\0" */ |
174 | ARPHRD_HIPPI, /* "hippi" "\0" */ |
175 | ARPHRD_ASH, /* "ash" "\0" */ |
176 | ARPHRD_ECONET, /* "econet" "\0" */ |
177 | ARPHRD_FCPP, /* "fcpp" "\0" */ |
178 | ARPHRD_FCAL, /* "fcal" "\0" */ |
179 | ARPHRD_FCPL, /* "fcpl" "\0" */ |
180 | ARPHRD_FCFABRIC, /* "fcfb0" "\0" */ |
181 | ARPHRD_FCFABRIC+1, /* "fcfb1" "\0" */ |
182 | ARPHRD_FCFABRIC+2, /* "fcfb2" "\0" */ |
183 | ARPHRD_FCFABRIC+3, /* "fcfb3" "\0" */ |
184 | ARPHRD_FCFABRIC+4, /* "fcfb4" "\0" */ |
185 | ARPHRD_FCFABRIC+5, /* "fcfb5" "\0" */ |
186 | ARPHRD_FCFABRIC+6, /* "fcfb6" "\0" */ |
187 | ARPHRD_FCFABRIC+7, /* "fcfb7" "\0" */ |
188 | ARPHRD_FCFABRIC+8, /* "fcfb8" "\0" */ |
189 | ARPHRD_FCFABRIC+9, /* "fcfb9" "\0" */ |
190 | ARPHRD_FCFABRIC+10, /* "fcfb10" "\0" */ |
191 | ARPHRD_FCFABRIC+11, /* "fcfb11" "\0" */ |
192 | ARPHRD_FCFABRIC+12, /* "fcfb12" "\0" */ |
193 | #endif /* FEATURE_IP_RARE_PROTOCOLS */ |
194 | }; |
195 | |
196 | unsigned i; |
197 | const char *aname = arphrd_name; |
198 | for (i = 0; i < ARRAY_SIZE(arphrd_type); i++) { |
199 | if (arphrd_type[i] == type) |
200 | return aname; |
201 | aname += strlen(aname) + 1; |
202 | } |
203 | sprintf(buf, "[%d]", type); |
204 | return buf; |
205 | } |