Skip to content

Commit 6f075d6

Browse files
fix(renderer): add more common protocols to protoname renderer (#341)
* fix(renderer): add more common protocols to protoname renderer, add unassigned, experimental and reserved to protoname renderer --------- Co-authored-by: marioschaefer <m.schaefer@unitedro.de>
1 parent 95cb0e4 commit 6f075d6

File tree

1 file changed

+162
-3
lines changed

1 file changed

+162
-3
lines changed

producer/proto/render.go

Lines changed: 162 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,152 @@ var (
6161
0x86dd: "IPv6",
6262
}
6363
protoName = map[uint32]string{
64+
0: "HOPOPT",
6465
1: "ICMP",
66+
2: "IGMP",
67+
3: "GGP",
68+
4: "IPv4",
69+
5: "ST",
6570
6: "TCP",
71+
7: "CBT",
72+
8: "EGP",
73+
9: "IGP",
74+
10: "BBN-RCC-MON",
75+
11: "NVP-II",
76+
12: "PUP",
77+
13: "ARGUS",
78+
14: "EMCON",
79+
15: "XNET",
80+
16: "CHAOS",
6681
17: "UDP",
67-
58: "ICMPv6",
82+
18: "MUX",
83+
19: "DCN-MEAS",
84+
20: "HMP",
85+
21: "PRM",
86+
22: "XNS-IDP",
87+
23: "TRUNK-1",
88+
24: "TRUNK-2",
89+
25: "LEAF-1",
90+
26: "LEAF-2",
91+
27: "RDP",
92+
28: "IRTP",
93+
29: "ISO-TP4",
94+
30: "NETBLT",
95+
31: "MFE-NSP",
96+
32: "MERIT-INP",
97+
33: "DCCP",
98+
34: "3PC",
99+
35: "IDPR",
100+
36: "XTP",
101+
37: "DDP",
102+
38: "IDPR-CMTP",
103+
39: "TP++",
104+
40: "IL",
105+
41: "IPv6",
106+
42: "SDRP",
107+
43: "IPv6-Route",
108+
44: "IPv6-Frag",
109+
45: "IDRP",
110+
46: "RSVP",
111+
47: "GRE",
112+
48: "DSR",
113+
49: "BNA",
114+
50: "ESP",
115+
51: "AH",
116+
52: "I-NLSP",
117+
53: "SWIPE",
118+
54: "NARP",
119+
55: "Min-IPv4",
120+
56: "TLSP",
121+
57: "SKIP",
122+
58: "IPv6-ICMP",
123+
59: "IPv6-NoNxt",
124+
60: "IPv6-Opts",
125+
61: "any-host-internal-protocol",
126+
62: "CFTP",
127+
63: "any-local-network",
128+
64: "SAT-EXPAK",
129+
65: "KRYPTOLAN",
130+
66: "RVD",
131+
67: "IPPC",
132+
68: "any-distributed-file-system",
133+
69: "SAT-MON",
134+
70: "VISA",
135+
71: "IPCV",
136+
72: "CPNX",
137+
73: "CPHB",
138+
74: "WSN",
139+
75: "PVP",
140+
76: "BR-SAT-MON",
141+
77: "SUN-ND",
142+
78: "WB-MON",
143+
79: "WB-EXPAK",
144+
80: "ISO-IP",
145+
81: "VMTP",
146+
82: "SECURE-VMTP",
147+
83: "VINES",
148+
84: "IPTM",
149+
85: "NSFNET-IGP",
150+
86: "DGP",
151+
87: "TCF",
152+
88: "EIGRP",
153+
89: "OSPFIGP",
154+
90: "Sprite-RPC",
155+
91: "LARP",
156+
92: "MTP",
157+
93: "AX.25",
158+
94: "IPIP",
159+
95: "MICP",
160+
96: "SCC-SP",
161+
97: "ETHERIP",
162+
98: "ENCAP",
163+
99: "any-private-encryption-scheme",
164+
100: "GMTP",
165+
101: "IFMP",
166+
102: "PNNI",
167+
103: "PIM",
168+
104: "ARIS",
169+
105: "SCPS",
170+
106: "QNX",
171+
107: "A/N",
172+
108: "IPComp",
173+
109: "SNP",
174+
110: "Compaq-Peer",
175+
111: "IPX-in-IP",
176+
112: "VRRP",
177+
113: "PGM",
178+
114: "any-0-hop-protocol",
179+
115: "L2TP",
180+
116: "DDX",
181+
117: "IATP",
182+
118: "STP",
183+
119: "SRP",
184+
120: "UTI",
185+
121: "SMP",
186+
122: "SM",
187+
123: "PTP",
188+
124: "ISIS over IPv4",
189+
125: "FIRE",
190+
126: "CRTP",
191+
127: "CRUDP",
192+
128: "SSCOPMCE",
193+
129: "IPLT",
194+
130: "SPS",
195+
131: "PIPE",
68196
132: "SCTP",
197+
133: "FC",
198+
134: "RSVP-E2E-IGNORE",
199+
135: "Mobility Header",
200+
136: "UDPLite",
201+
137: "MPLS-in-IP",
202+
138: "manet",
203+
139: "HIP",
204+
140: "Shim6",
205+
141: "WESP",
206+
142: "ROHC",
207+
143: "Ethernet",
208+
144: "AGGFRAG",
209+
145: "NSH",
69210
}
70211
icmpTypeName = map[uint32]string{
71212
0: "EchoReply",
@@ -169,11 +310,29 @@ func EtypeRenderer(msg *ProtoProducerMessage, fieldName string, data interface{}
169310
return "unknown"
170311
}
171312

313+
func ProtoName(protoNumber uint32) string {
314+
if (protoNumber >= 146) && (protoNumber <= 252) {
315+
return "unassigned"
316+
}
317+
if (protoNumber >= 253) && (protoNumber <= 254) {
318+
return "experimental"
319+
}
320+
if protoNumber == 255 {
321+
return "reserved"
322+
}
323+
dataC, ok := protoName[protoNumber]
324+
if ok {
325+
return dataC
326+
} else {
327+
return "unknown"
328+
}
329+
}
330+
172331
func ProtoRenderer(msg *ProtoProducerMessage, fieldName string, data interface{}) interface{} {
173332
if dataC, ok := data.(uint32); ok {
174-
return protoName[dataC]
333+
return ProtoName(dataC)
175334
} else if dataC, ok := data.(uint64); ok {
176-
return protoName[uint32(dataC)]
335+
return ProtoName(uint32(dataC))
177336
}
178337
return "unknown"
179338
}

0 commit comments

Comments
 (0)