1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
|
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that: (1) source code
* distributions retain the above copyright notice and this paragraph
* in its entirety, and (2) distributions including binary code include
* the above copyright notice and this paragraph in its entirety in
* the documentation or other materials provided with the distribution.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND
* WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
* LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE.
*
* Original code by Hannes Gredler (hannes@gredler.at)
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <netdissect-stdinc.h>
#include "netdissect.h"
#include "ipproto.h"
const struct tok ipproto_values[] = {
{ IPPROTO_HOPOPTS, "Options" },
{ IPPROTO_ICMP, "ICMP" },
{ IPPROTO_IGMP, "IGMP" },
{ IPPROTO_IPV4, "IPIP" },
{ IPPROTO_TCP, "TCP" },
{ IPPROTO_EGP, "EGP" },
{ IPPROTO_PIGP, "IGRP" },
{ IPPROTO_UDP, "UDP" },
{ IPPROTO_DCCP, "DCCP" },
{ IPPROTO_IPV6, "IPv6" },
{ IPPROTO_ROUTING, "Routing" },
{ IPPROTO_FRAGMENT, "Fragment" },
{ IPPROTO_RSVP, "RSVP" },
{ IPPROTO_GRE, "GRE" },
{ IPPROTO_ESP, "ESP" },
{ IPPROTO_AH, "AH" },
{ IPPROTO_MOBILE, "Mobile IP" },
{ IPPROTO_ICMPV6, "ICMPv6" },
{ IPPROTO_MOBILITY_OLD, "Mobile IP (old)" },
{ IPPROTO_EIGRP, "EIGRP" },
{ IPPROTO_OSPF, "OSPF" },
{ IPPROTO_PIM, "PIM" },
{ IPPROTO_IPCOMP, "Compressed IP" },
{ IPPROTO_VRRP, "VRRP" },
{ IPPROTO_PGM, "PGM" },
{ IPPROTO_SCTP, "SCTP" },
{ IPPROTO_MOBILITY, "Mobility" },
{ IPPROTO_CARP, "CARP" },
{ 0, NULL }
};
/*
* For completeness the number space in the array below comes from IANA:
* https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml
* However, the spelling tries to match that of /etc/protocols to achieve as
* much consistency as possible with the previously implemented behaviour,
* which was based on getprotobynumber (3).
*/
static const char *netdb_protocol_names[256] = {
"hopopt", /* 0 (IPPROTO_HOPOPTS, IPv6 Hop-by-Hop Option) */
"icmp", /* 1 (IPPROTO_ICMP, Internet Control Message) */
"igmp", /* 2 (IPPROTO_IGMP, Internet Group Management) */
"ggp", /* 3 (Gateway-to-Gateway) */
"ipencap", /* 4 (IPPROTO_IPV4, IPv4 encapsulation) */
"st", /* 5 (Stream, ST datagram mode) */
"tcp", /* 6 (IPPROTO_TCP, Transmission Control) */
"cbt", /* 7 (CBT) */
"egp", /* 8 (IPPROTO_EGP, Exterior Gateway Protocol) */
"igp", /* 9 (IPPROTO_PIGP, "any private interior gateway
* (used by Cisco for their IGRP)")
*/
"bbn-rcc-mon", /* 10 (BBN RCC Monitoring) */
"nvp-ii", /* 11 (Network Voice Protocol) */
"pup", /* 12 (PARC universal packet protocol) */
"argus", /* 13 (ARGUS) */
"emcon", /* 14 (EMCON) */
"xnet", /* 15 (Cross Net Debugger) */
"chaos", /* 16 (Chaos) */
"udp", /* 17 (IPPROTO_UDP, User Datagram) */
"mux", /* 18 (Multiplexing) */
"dcn-meas", /* 19 (DCN Measurement Subsystems) */
"hmp", /* 20 (Host Monitoring) */
"prm", /* 21 (Packet Radio Measurement) */
"xns-idp", /* 22 (XEROX NS IDP) */
"trunk-1", /* 23 (Trunk-1) */
"trunk-2", /* 24 (Trunk-2) */
"leaf-1", /* 25 (Leaf-1) */
"leaf-2", /* 26 (Leaf-2) */
"rdp", /* 27 (Reliable Data Protocol) */
"irtp", /* 28 (Internet Reliable Transaction) */
"iso-tp4", /* 29 (ISO Transport Protocol Class 4) */
"netblt", /* 30 (Bulk Data Transfer Protocol) */
"mfe-nsp", /* 31 (MFE Network Services Protocol) */
"merit-inp", /* 32 (MERIT Internodal Protocol) */
"dccp", /* 33 (IPPROTO_DCCP, Datagram Congestion
* Control Protocol)
*/
"3pc", /* 34 (Third Party Connect Protocol) */
"idpr", /* 35 (Inter-Domain Policy Routing Protocol) */
"xtp", /* 36 (Xpress Transfer Protocol) */
"ddp", /* 37 (Datagram Delivery Protocol) */
"idpr-cmtp", /* 38 (IDPR Control Message Transport Proto) */
"tp++", /* 39 (TP++ Transport Protocol) */
"il", /* 40 (IL Transport Protocol) */
"ipv6", /* 41 (IPPROTO_IPV6, IPv6 encapsulation) */
"sdrp", /* 42 (Source Demand Routing Protocol) */
"ipv6-route", /* 43 (IPPROTO_ROUTING, Routing Header for IPv6) */
"ipv6-frag", /* 44 (IPPROTO_FRAGMENT, Fragment Header for
* IPv6)
*/
"idrp", /* 45 (Inter-Domain Routing Protocol) */
"rsvp", /* 46 (IPPROTO_RSVP, Reservation Protocol) */
"gre", /* 47 (IPPROTO_GRE, Generic Routing
* Encapsulation)
*/
"dsr", /* 48 (Dynamic Source Routing Protocol) */
"bna", /* 49 (BNA) */
"esp", /* 50 (IPPROTO_ESP, Encap Security Payload) */
"ah", /* 51 (IPPROTO_AH, Authentication Header) */
"i-nlsp", /* 52 (Integrated Net Layer Security TUBA) */
"swipe", /* 53 (IP with Encryption) */
"narp", /* 54 (NBMA Address Resolution Protocol) */
"mobile", /* 55 (IPPROTO_MOBILE, IP Mobility) */
"tlsp", /* 56 (Transport Layer Security Protocol using
* Kryptonet key management)
*/
"skip", /* 57 (SKIP) */
"ipv6-icmp", /* 58 (IPPROTO_ICMPV6, ICMP for IPv6) */
"ipv6-nonxt", /* 59 (IPPROTO_NONE, No Next Header for IPv6) */
"ipv6-opts", /* 60 (IPPROTO_DSTOPTS, Destination Options for
* IPv6)
*/
NULL, /* 61 (any host internal protocol) */
"cftp", /* 62 (IPPROTO_MOBILITY_OLD, CFTP, see the note
* in ipproto.h)
*/
NULL, /* 63 (any local network) */
"sat-expak", /* 64 (SATNET and Backroom EXPAK) */
"kryptolan", /* 65 (Kryptolan) */
"rvd", /* 66 (MIT Remote Virtual Disk Protocol) */
"ippc", /* 67 (Internet Pluribus Packet Core) */
NULL, /* 68 (any distributed file system) */
"sat-mon", /* 69 (SATNET Monitoring) */
"visa", /* 70 (VISA Protocol) */
"ipcv", /* 71 (Internet Packet Core Utility) */
"cpnx", /* 72 (Computer Protocol Network Executive) */
"rspf", /* 73 (Radio Shortest Path First, CPHB -- Computer
* Protocol Heart Beat -- in IANA)
*/
"wsn", /* 74 (Wang Span Network) */
"pvp", /* 75 (Packet Video Protocol) */
"br-sat-mon", /* 76 (Backroom SATNET Monitoring) */
"sun-nd", /* 77 (IPPROTO_ND, SUN ND PROTOCOL-Temporary) */
"wb-mon", /* 78 (WIDEBAND Monitoring) */
"wb-expak", /* 79 (WIDEBAND EXPAK) */
"iso-ip", /* 80 (ISO Internet Protocol) */
"vmtp", /* 81 (Versatile Message Transport) */
"secure-vmtp", /* 82 (Secure VMTP) */
"vines", /* 83 (VINES) */
"ttp", /* 84 (Transaction Transport Protocol, also IPTM --
* Internet Protocol Traffic Manager)
*/
"nsfnet-igp", /* 85 (NSFNET-IGP) */
"dgp", /* 86 (Dissimilar Gateway Protocol) */
"tcf", /* 87 (TCF) */
"eigrp", /* 88 (IPPROTO_EIGRP, Cisco EIGRP) */
"ospf", /* 89 (IPPROTO_OSPF, Open Shortest Path First
* IGP)
*/
"sprite-rpc", /* 90 (Sprite RPC Protocol) */
"larp", /* 91 (Locus Address Resolution Protocol) */
"mtp", /* 92 (Multicast Transport Protocol) */
"ax.25", /* 93 (AX.25 Frames) */
"ipip", /* 94 (IP-within-IP Encapsulation Protocol) */
"micp", /* 95 (Mobile Internetworking Control Pro.) */
"scc-sp", /* 96 (Semaphore Communications Sec. Pro.) */
"etherip", /* 97 (Ethernet-within-IP Encapsulation) */
"encap", /* 98 (Encapsulation Header) */
NULL, /* 99 (any private encryption scheme) */
"gmtp", /* 100 (GMTP) */
"ifmp", /* 101 (Ipsilon Flow Management Protocol) */
"pnni", /* 102 (PNNI over IP) */
"pim", /* 103 (IPPROTO_PIM, Protocol Independent
* Multicast)
*/
"aris", /* 104 (ARIS) */
"scps", /* 105 (SCPS) */
"qnx", /* 106 (QNX) */
"a/n", /* 107 (Active Networks) */
"ipcomp", /* 108 (IPPROTO_IPCOMP, IP Payload Compression
* Protocol)
*/
"snp", /* 109 (Sitara Networks Protocol) */
"compaq-peer", /* 110 (Compaq Peer Protocol) */
"ipx-in-ip", /* 111 (IPX in IP) */
"vrrp", /* 112 (IPPROTO_VRRP, Virtual Router Redundancy
* Protocol)
*/
"pgm", /* 113 (IPPROTO_PGM, PGM Reliable Transport
* Protocol)
*/
NULL, /* 114 (any 0-hop protocol) */
"l2tp", /* 115 (Layer Two Tunneling Protocol) */
"ddx", /* 116 (D-II Data Exchange (DDX)) */
"iatp", /* 117 (Interactive Agent Transfer Protocol) */
"stp", /* 118 (Schedule Transfer Protocol) */
"srp", /* 119 (SpectraLink Radio Protocol) */
"uti", /* 120 (UTI) */
"smp", /* 121 (Simple Message Protocol) */
"sm", /* 122 (Simple Multicast Protocol) */
"ptp", /* 123 (Performance Transparency Protocol) */
"isis", /* 124 (ISIS over IPv4) */
"fire", /* 125 (FIRE) */
"crtp", /* 126 (Combat Radio Transport Protocol) */
"crudp", /* 127 (Combat Radio User Datagram) */
"sscopmce", /* 128 (SSCOPMCE) */
"iplt", /* 129 (IPLT) */
"sps", /* 130 (Secure Packet Shield) */
"pipe", /* 131 (Private IP Encapsulation within IP) */
"sctp", /* 132 (IPPROTO_SCTP, Stream Control Transmission
* Protocol)
*/
"fc", /* 133 (Fibre Channel) */
"rsvp-e2e-ignore", /* 134 (RSVP-E2E-IGNORE) */
"mobility-header", /* 135 (IPPROTO_MOBILITY, Mobility Header) */
"udplite", /* 136 (UDPLite) */
"mpls-in-ip", /* 137 (MPLS-in-IP) */
"manet", /* 138 (MANET Protocols) */
"hip", /* 139 (Host Identity Protocol) */
"shim6", /* 140 (Shim6 Protocol) */
"wesp", /* 141 (Wrapped Encapsulating Security Payload) */
"rohc", /* 142 (Robust Header Compression) */
NULL, /* 143 (unassigned) */
NULL, /* 144 (unassigned) */
NULL, /* 145 (unassigned) */
NULL, /* 146 (unassigned) */
NULL, /* 147 (unassigned) */
NULL, /* 148 (unassigned) */
NULL, /* 149 (unassigned) */
NULL, /* 150 (unassigned) */
NULL, /* 151 (unassigned) */
NULL, /* 152 (unassigned) */
NULL, /* 153 (unassigned) */
NULL, /* 154 (unassigned) */
NULL, /* 155 (unassigned) */
NULL, /* 156 (unassigned) */
NULL, /* 157 (unassigned) */
NULL, /* 158 (unassigned) */
NULL, /* 159 (unassigned) */
NULL, /* 160 (unassigned) */
NULL, /* 161 (unassigned) */
NULL, /* 162 (unassigned) */
NULL, /* 163 (unassigned) */
NULL, /* 164 (unassigned) */
NULL, /* 165 (unassigned) */
NULL, /* 166 (unassigned) */
NULL, /* 167 (unassigned) */
NULL, /* 168 (unassigned) */
NULL, /* 169 (unassigned) */
NULL, /* 170 (unassigned) */
NULL, /* 171 (unassigned) */
NULL, /* 172 (unassigned) */
NULL, /* 173 (unassigned) */
NULL, /* 174 (unassigned) */
NULL, /* 175 (unassigned) */
NULL, /* 176 (unassigned) */
NULL, /* 177 (unassigned) */
NULL, /* 178 (unassigned) */
NULL, /* 179 (unassigned) */
NULL, /* 180 (unassigned) */
NULL, /* 181 (unassigned) */
NULL, /* 182 (unassigned) */
NULL, /* 183 (unassigned) */
NULL, /* 184 (unassigned) */
NULL, /* 185 (unassigned) */
NULL, /* 186 (unassigned) */
NULL, /* 187 (unassigned) */
NULL, /* 188 (unassigned) */
NULL, /* 189 (unassigned) */
NULL, /* 190 (unassigned) */
NULL, /* 191 (unassigned) */
NULL, /* 192 (unassigned) */
NULL, /* 193 (unassigned) */
NULL, /* 194 (unassigned) */
NULL, /* 195 (unassigned) */
NULL, /* 196 (unassigned) */
NULL, /* 197 (unassigned) */
NULL, /* 198 (unassigned) */
NULL, /* 199 (unassigned) */
NULL, /* 200 (unassigned) */
NULL, /* 201 (unassigned) */
NULL, /* 202 (unassigned) */
NULL, /* 203 (unassigned) */
NULL, /* 204 (unassigned) */
NULL, /* 205 (unassigned) */
NULL, /* 206 (unassigned) */
NULL, /* 207 (unassigned) */
NULL, /* 208 (unassigned) */
NULL, /* 209 (unassigned) */
NULL, /* 210 (unassigned) */
NULL, /* 211 (unassigned) */
NULL, /* 212 (unassigned) */
NULL, /* 213 (unassigned) */
NULL, /* 214 (unassigned) */
NULL, /* 215 (unassigned) */
NULL, /* 216 (unassigned) */
NULL, /* 217 (unassigned) */
NULL, /* 218 (unassigned) */
NULL, /* 219 (unassigned) */
NULL, /* 220 (unassigned) */
NULL, /* 221 (unassigned) */
NULL, /* 222 (unassigned) */
NULL, /* 223 (unassigned) */
NULL, /* 224 (unassigned) */
NULL, /* 225 (unassigned) */
NULL, /* 226 (unassigned) */
NULL, /* 227 (unassigned) */
NULL, /* 228 (unassigned) */
NULL, /* 229 (unassigned) */
NULL, /* 230 (unassigned) */
NULL, /* 231 (unassigned) */
NULL, /* 232 (unassigned) */
NULL, /* 233 (unassigned) */
NULL, /* 234 (unassigned) */
NULL, /* 235 (unassigned) */
NULL, /* 236 (unassigned) */
NULL, /* 237 (unassigned) */
NULL, /* 238 (unassigned) */
NULL, /* 239 (unassigned) */
NULL, /* 240 (unassigned) */
NULL, /* 241 (unassigned) */
NULL, /* 242 (unassigned) */
NULL, /* 243 (unassigned) */
NULL, /* 244 (unassigned) */
NULL, /* 245 (unassigned) */
NULL, /* 246 (unassigned) */
NULL, /* 247 (unassigned) */
NULL, /* 248 (unassigned) */
NULL, /* 249 (unassigned) */
NULL, /* 250 (unassigned) */
NULL, /* 251 (unassigned) */
NULL, /* 252 (unassigned) */
"exptest-253", /* 253 (Use for experimentation and testing,
* RFC 3692)
*/
"exptest-254", /* 254 (Use for experimentation and testing,
* RFC 3692)
*/
"reserved", /* 255 (reserved) */
};
/* The function enforces the array index to be 8-bit. */
const char *
netdb_protoname (const nd_uint8_t protoid)
{
return netdb_protocol_names[protoid];
}
|