1 /* packet-netlink-route.c
3 * Wireshark - Network traffic analyzer
4 * By Gerald Combs <gerald@wireshark.org>
5 * Copyright 1998 Gerald Combs
7 * SPDX-License-Identifier: GPL-2.0-or-later
14 #include <epan/packet.h>
15 #include <epan/aftypes.h>
16 #include <epan/to_str.h>
18 #include <wsutil/array.h>
20 #include "packet-arp.h"
21 #include "packet-netlink.h"
23 void proto_register_netlink_route(void);
24 void proto_reg_handoff_netlink_route(void);
27 * The "legacy" flag indicates that the packet is a legacy dump
30 * Some legacy tools, including iproute2 < 3.9, issue shorter RTM_GETLINK
31 * and RTM_GETADDR dump queries which only contain struct rtgenmsg rather
32 * than struct ifinfomsg. As noted in kernel comment in rtnl_dump_ifinfo(),
33 * these legacy requests will be (even with attributes) always shorter than
34 * struct ifinfomsg so that they are easy to detect.
36 * Similar problem can be observed with tools using nl_rtgen_request()
37 * function from libnl3; this also affects other RTM_GET* types.
39 * If such legacy message is detected by length shorter than expected data
40 * structure, we parse it as this legacy version with (1-byte) struct
41 * rtgenmsg so that it's shown as intended rather than as malformed.
43 * The legacy messages appear, from looking at the iproute2 3.1.0 code,
44 * to be a structure containing a struct nlmsghdr followed by a struct
47 * struct rtgenmsg contains only a 1-byte address family value, as noted.
48 * *However*, a struct nlmsghdr has a 4-byte length field, and is, as a
49 * result, aligned on a 4-byte boundary, so the structure containing those
50 * two structures is also aligned on a 4-byte boundary, and thus has a
51 * length that's a multiple of 4 bytes. Therefore, there are 3 bytes of
52 * padding following the address family byte.
54 * The message length, however, doesn't include those bytes.
56 * Legacy messages don't include any attributes - they're not large enough
57 * to contain anything other than the netlink message header and the one-byte
58 * address family. For legacy messages, the attribute we hand to
59 * dissect_netlink_route_attributes() is not aligned on a 4-byte boundary,
60 * as it's the offset right after the 1-byte address family value;
61 * dissect_netlink_route_attributes() will try to align that on a 4-byte
62 * boundary, but that will go past the "immediately after the end of
63 * the packet" offset, which can cause problems if any checking is done
64 * to make sure the offset is valid. Therefore, we don't try to dissect
65 * the attributes, rather than relying on the attributes dissector to
66 * discover that there's nothing left in the packet.
68 struct netlink_route_info
{
74 /* rtnetlink values for nlmsghdr.nlmsg_type from <include/uapi/linux/rtnetlink.h> */
94 WS_RTM_NEWTCLASS
= 40,
95 WS_RTM_DELTCLASS
= 41,
96 WS_RTM_GETTCLASS
= 42,
97 WS_RTM_NEWTFILTER
= 44,
98 WS_RTM_DELTFILTER
= 45,
99 WS_RTM_GETTFILTER
= 46,
100 WS_RTM_NEWACTION
= 48,
101 WS_RTM_DELACTION
= 49,
102 WS_RTM_GETACTION
= 50,
103 WS_RTM_NEWPREFIX
= 52,
104 WS_RTM_GETMULTICAST
= 58,
105 WS_RTM_GETANYCAST
= 62,
106 WS_RTM_NEWNEIGHTBL
= 64,
107 WS_RTM_GETNEIGHTBL
= 66,
108 WS_RTM_SETNEIGHTBL
= 67,
109 WS_RTM_NEWNDUSEROPT
= 68,
110 WS_RTM_NEWADDRLABEL
= 72,
111 WS_RTM_DELADDRLABEL
= 73,
112 WS_RTM_GETADDRLABEL
= 74,
115 WS_RTM_NEWNETCONF
= 80,
116 WS_RTM_DELNETCONF
= 81,
117 WS_RTM_GETNETCONF
= 82,
124 WS_RTM_NEWSTATS
= 92,
125 WS_RTM_GETSTATS
= 94,
126 WS_RTM_NEWCACHEREPORT
= 96,
127 WS_RTM_NEWCHAIN
= 100,
128 WS_RTM_DELCHAIN
= 101,
129 WS_RTM_GETCHAIN
= 102,
130 WS_RTM_NEWNEXTHOP
= 104,
131 WS_RTM_DELNEXTHOP
= 105,
132 WS_RTM_GETNEXTHOP
= 106,
133 WS_RTM_NEWLINKPROP
= 108,
134 WS_RTM_DELLINKPROP
= 109,
135 WS_RTM_GETLINKPROP
= 110,
136 WS_RTM_NEWVLAN
= 112,
137 WS_RTM_DELVLAN
= 113,
138 WS_RTM_GETVLAN
= 114,
139 WS_RTM_NEWNEXTHOPBUCKET
= 116,
140 WS_RTM_DELNEXTHOPBUCKET
= 117,
141 WS_RTM_GETNEXTHOPBUCKET
= 118,
142 WS_RTM_NEWTUNNEL
= 120,
143 WS_RTM_DELTUNNEL
= 121,
144 WS_RTM_GETTUNNEL
= 122,
147 /* values for rta_type (network interface) from </include/uapi/linux/if_link.h> */
148 enum ws_ifla_attr_type
{
151 WS_IFLA_BROADCAST
= 2,
158 WS_IFLA_PRIORITY
= 9,
160 WS_IFLA_WIRELESS
= 11,
161 WS_IFLA_PROTINFO
= 12,
165 WS_IFLA_OPERSTATE
= 16,
166 WS_IFLA_LINKMODE
= 17,
167 WS_IFLA_LINKINFO
= 18,
168 WS_IFLA_NET_NS_PID
= 19,
169 WS_IFLA_IFALIAS
= 20,
171 WS_IFLA_VFINFO_LIST
= 22,
172 WS_IFLA_STATS64
= 23,
173 WS_IFLA_VF_PORTS
= 24,
174 WS_IFLA_PORT_SELF
= 25,
175 WS_IFLA_AF_SPEC
= 26,
177 WS_IFLA_NET_NS_FD
= 28,
178 WS_IFLA_EXT_MASK
= 29,
179 WS_IFLA_PROMISCUITY
= 30,
180 WS_IFLA_NUM_TX_QUEUES
= 31,
181 WS_IFLA_NUM_RX_QUEUES
= 32,
182 WS_IFLA_CARRIER
= 33,
183 WS_IFLA_PHYS_PORT_ID
= 34,
184 WS_IFLA_CARRIER_CHANGES
= 35,
185 WS_IFLA_PHYS_SWITCH_ID
= 36,
186 WS_IFLA_LINK_NETNSID
= 37,
187 WS_IFLA_PHYS_PORT_NAME
= 38,
188 WS_IFLA_PROTO_DOWN
= 39,
189 WS_IFLA_GSO_MAX_SEGS
= 40,
190 WS_IFLA_GSO_MAX_SIZE
= 41,
194 WS_IFLA_NEW_NETNSID
= 45,
195 WS_IFLA_IF_NETNSID
= 46,
196 WS_IFLA_CARRIER_UP_COUNT
= 47,
197 WS_IFLA_CARRIER_DOWN_COUNT
= 48,
198 WS_IFLA_NEW_IFINDEX
= 49,
199 WS_IFLA_MIN_MTU
= 50,
200 WS_IFLA_MAX_MTU
= 51,
201 WS_IFLA_PROP_LIST
= 52,
202 WS_IFLA_ALT_IFNAME
= 53,
203 WS_IFLA_PERM_ADDRESS
= 54,
204 WS_IFLA_PROTO_DOWN_REASON
= 55,
205 WS_IFLA_PARENT_DEV_NAME
= 56,
206 WS_IFLA_PARENT_DEV_BUS_NAME
= 57,
207 WS_IFLA_GRO_MAX_SIZE
= 58,
208 WS_IFLA_TSO_MAX_SIZE
= 59,
209 WS_IFLA_TSO_MAX_SEGS
= 60,
210 WS_IFLA_ALLMULTI
= 61,
213 /* values for rta_type (ip address) from <include/uapi/linux/if_addr.h> */
214 enum ws_ifa_attr_type
{
219 WS_IFA_BROADCAST
= 4,
221 WS_IFA_CACHEINFO
= 6,
222 WS_IFA_MULTICAST
= 7,
224 WS_IFA_RT_PRIORITY
= 9,
225 WS_IFA_TARGET_NETNSID
= 10,
229 /* values for rta_type (route) from <include/uapi/linux/rtnetlink.h> */
230 enum ws_rta_attr_type
{
240 WS_RTA_MULTIPATH
= 9,
241 WS_RTA_PROTOINFO
= 10,
243 WS_RTA_CACHEINFO
= 12,
248 WS_RTA_MFC_STATS
= 17,
252 WS_RTA_ENCAP_TYPE
= 21,
257 WS_RTA_TTL_PROPAGATE
= 26,
258 WS_RTA_IP_PROTO
= 27,
265 /* values for rtmsg.rtm_protocol from <include/uapi/linux/rtnetlink.h> */
268 WS_RTPROT_UNSPEC
= 0,
269 WS_RTPROT_REDIRECT
= 1,
270 WS_RTPROT_KERNEL
= 2,
272 WS_RTPROT_STATIC
= 4,
277 WS_RTPROT_ZEBRA
= 11,
279 WS_RTPROT_DNROUTED
= 13,
283 WS_RTPROT_MROUTED
= 17,
284 WS_RTPROT_KEEPALIVED
= 18,
285 WS_RTPROT_BABEL
= 42,
286 WS_RTPROT_OPENR
= 99,
288 WS_RTPROT_ISIS
= 187,
289 WS_RTPROT_OSPF
= 188,
291 WS_RTPROT_EIGRP
= 192,
294 /* values for rtmsg.rtm_scope from <include/uapi/linux/rtnetlink.h> */
296 WS_RT_SCOPE_UNIVERSE
= 0,
297 /* ... user defined (/etc/iproute2/rt_scopes) ... */
298 WS_RT_SCOPE_SITE
= 200,
299 WS_RT_SCOPE_LINK
= 253,
300 WS_RT_SCOPE_HOST
= 254,
301 WS_RT_SCOPE_NOWHERE
= 255
304 /* values for rtmsg.rtm_type from <include/uapi/linux/rtnetlink.h> */
309 WS_RTN_BROADCAST
= 3,
311 WS_RTN_MULTICAST
= 5,
312 WS_RTN_BLACKHOLE
= 6,
313 WS_RTN_UNREACHABLE
= 7,
320 /* values for ifinfomsg.ifi_flags <include/uapi/linux/if.h> */
323 WS_IFF_BROADCAST
= 0x2,
325 WS_IFF_LOOPBACK
= 0x8,
326 WS_IFF_POINTOPOINT
= 0x10,
327 WS_IFF_NOTRAILERS
= 0x20,
328 WS_IFF_RUNNING
= 0x40,
330 WS_IFF_PROMISC
= 0x100,
331 WS_IFF_ALLMULTI
= 0x200,
332 WS_IFF_MASTER
= 0x400,
333 WS_IFF_SLAVE
= 0x800,
334 WS_IFF_MULTICAST
= 0x1000,
335 WS_IFF_PORTSEL
= 0x2000,
336 WS_IFF_AUTOMEDIA
= 0x4000,
337 WS_IFF_DYNAMIC
= 0x8000,
338 WS_IFF_LOWER_UP
= 0x10000,
339 WS_IFF_DORMANT
= 0x20000,
340 WS_IFF_ECHO
= 0x40000
343 /* values for ifaddrmsg.ifa_flags <include/uapi/linux/if_addr.h> */
345 WS_IFA_F_SECONDARY
= 0x01,
346 WS_IFA_F_NODAD
= 0x02,
347 WS_IFA_F_OPTIMISTIC
= 0x04,
348 WS_IFA_F_DADFAILED
= 0x08,
349 WS_IFA_F_HOMEADDRESS
= 0x10,
350 WS_IFA_F_DEPRECATED
= 0x20,
351 WS_IFA_F_TENTATIVE
= 0x40,
352 WS_IFA_F_PERMANENT
= 0x80,
353 WS_IFA_F_MANAGETEMPADDR
= 0x100,
354 WS_IFA_F_NOPREFIXROUTE
= 0x200,
355 WS_IFA_F_MCAUTOJOIN
= 0x400,
356 WS_IFA_F_STABLE_PRIVACY
= 0x800,
359 /* values for ndmsg.ndm_state <include/uapi/linux/neighbour.h> */
361 WS_NUD_INCOMPLETE
= 0x01,
362 WS_NUD_REACHABLE
= 0x02,
366 WS_NUD_FAILED
= 0x20,
369 WS_NUD_PERMANENT
= 0x80,
373 /* values for ifla.operstate <include/uapi/linux/if.h> */
376 WS_IF_OPER_NOTPRESENT
,
378 WS_IF_OPER_LOWERLAYERDOWN
,
384 static int proto_netlink_route
;
386 static dissector_handle_t netlink_route_handle
;
388 static int hf_netlink_route_ifa_addr4
;
389 static int hf_netlink_route_ifa_addr6
;
390 static int hf_netlink_route_ifa_attr_type
;
391 static int hf_netlink_route_ifa_family
;
392 static int hf_netlink_route_ifa_flags
;
393 static int hf_netlink_route_ifa_flags32
;
394 static int hf_netlink_route_ifa_index
;
395 static int hf_netlink_route_ifa_label
;
396 static int hf_netlink_route_ifa_prefixlen
;
397 static int hf_netlink_route_ifa_scope
;
398 static int hf_netlink_route_ifi_change
;
399 static int hf_netlink_route_ifi_family
;
400 static int hf_netlink_route_ifi_flags
;
401 static int hf_netlink_route_ifi_flags_iff_broadcast
;
402 static int hf_netlink_route_ifi_flags_iff_up
;
403 static int hf_netlink_route_ifi_index
;
404 static int hf_netlink_route_ifi_type
;
405 static int hf_netlink_route_ifla_attr_type
;
406 static int hf_netlink_route_ifla_broadcast
;
407 static int hf_netlink_route_ifla_carrier
;
408 static int hf_netlink_route_ifla_carrier_changes
;
409 static int hf_netlink_route_ifla_carrier_down_count
;
410 static int hf_netlink_route_ifla_carrier_up_count
;
411 static int hf_netlink_route_ifla_group
;
412 static int hf_netlink_route_ifla_gso_maxsegs
;
413 static int hf_netlink_route_ifla_gso_maxsize
;
414 static int hf_netlink_route_ifla_hwaddr
;
415 static int hf_netlink_route_ifla_ifname
;
416 static int hf_netlink_route_ifla_linkstats_collisions
;
417 static int hf_netlink_route_ifla_linkstats_multicast
;
418 static int hf_netlink_route_ifla_linkstats_rx_crc_errs
;
419 static int hf_netlink_route_ifla_linkstats_rx_fifo_errs
;
420 static int hf_netlink_route_ifla_linkstats_rx_frame_errs
;
421 static int hf_netlink_route_ifla_linkstats_rx_len_errs
;
422 static int hf_netlink_route_ifla_linkstats_rx_miss_errs
;
423 static int hf_netlink_route_ifla_linkstats_rx_over_errs
;
424 static int hf_netlink_route_ifla_linkstats_rxbytes
;
425 static int hf_netlink_route_ifla_linkstats_rxdropped
;
426 static int hf_netlink_route_ifla_linkstats_rxerrors
;
427 static int hf_netlink_route_ifla_linkstats_rxpackets
;
428 static int hf_netlink_route_ifla_linkstats_tx_abort_errs
;
429 static int hf_netlink_route_ifla_linkstats_tx_carrier_errs
;
430 static int hf_netlink_route_ifla_linkstats_tx_fifo_errs
;
431 static int hf_netlink_route_ifla_linkstats_tx_heartbeat_errs
;
432 static int hf_netlink_route_ifla_linkstats_tx_window_errs
;
433 static int hf_netlink_route_ifla_linkstats_txbytes
;
434 static int hf_netlink_route_ifla_linkstats_txdropped
;
435 static int hf_netlink_route_ifla_linkstats_txerrors
;
436 static int hf_netlink_route_ifla_linkstats_txpackets
;
437 static int hf_netlink_route_ifla_map_baseaddr
;
438 static int hf_netlink_route_ifla_map_dma
;
439 static int hf_netlink_route_ifla_map_irq
;
440 static int hf_netlink_route_ifla_map_memend
;
441 static int hf_netlink_route_ifla_map_memstart
;
442 static int hf_netlink_route_ifla_map_port
;
443 static int hf_netlink_route_ifla_max_mtu
;
444 static int hf_netlink_route_ifla_min_mtu
;
445 static int hf_netlink_route_ifla_mtu
;
446 static int hf_netlink_route_ifla_operstate
;
447 static int hf_netlink_route_ifla_promiscuity
;
448 static int hf_netlink_route_ifla_qdisc
;
449 static int hf_netlink_route_ifla_rxqnum
;
450 static int hf_netlink_route_ifla_txqlen
;
451 static int hf_netlink_route_ifla_txqnum
;
452 static int hf_netlink_route_nd_family
;
453 static int hf_netlink_route_nd_flags
;
454 static int hf_netlink_route_nd_index
;
455 static int hf_netlink_route_nd_state
;
456 static int hf_netlink_route_nd_type
;
457 static int hf_netlink_route_nltype
;
458 static int hf_netlink_route_rt_dst_len
;
459 static int hf_netlink_route_rt_family
;
460 static int hf_netlink_route_rt_flags
;
461 static int hf_netlink_route_rt_protocol
;
462 static int hf_netlink_route_rt_scope
;
463 static int hf_netlink_route_rt_src_len
;
464 static int hf_netlink_route_rt_table
;
465 static int hf_netlink_route_rt_tos
;
466 static int hf_netlink_route_rt_type
;
467 static int hf_netlink_route_rta_attr_type
;
468 static int hf_netlink_route_rta_iif
;
469 static int hf_netlink_route_rta_oif
;
471 static int ett_netlink_route
;
472 static int ett_netlink_route_attr
;
473 static int ett_netlink_route_if_flags
;
474 static int ett_netlink_route_attr_linkstats
;
475 static int ett_netlink_route_attr_linkstats_rxerrs
;
476 static int ett_netlink_route_attr_linkstats_txerrs
;
479 _fill_label_value_string_bitmask(char *label
, uint32_t value
, const value_string
*vals
)
485 while (vals
->strptr
) {
486 if (value
& vals
->value
) {
487 value
&= ~(vals
->value
);
489 (void) g_strlcat(label
, ", ", ITEM_LABEL_LENGTH
);
491 (void) g_strlcat(label
, vals
->strptr
, ITEM_LABEL_LENGTH
);
499 (void) g_strlcat(label
, ", ", ITEM_LABEL_LENGTH
);
500 snprintf(tmp
, sizeof(tmp
), "0x%x", value
);
501 (void) g_strlcat(label
, tmp
, ITEM_LABEL_LENGTH
);
506 dissect_netlink_route_attributes(tvbuff_t
*tvb
, int hf_type
, struct netlink_route_info
*info
, struct packet_netlink_data
*nl_data
, proto_tree
*tree
, int offset
, netlink_attributes_cb_t cb
)
508 /* XXX, it's *almost* the same:
509 * - rtnetlink is using struct rtattr with shorts
510 * - generic netlink is using struct nlattr with __u16
514 return dissect_netlink_attributes_to_end(tvb
, hf_type
, ett_netlink_route_attr
, info
, nl_data
, tree
, offset
, cb
);
518 hf_netlink_route_ifi_flags_label(char *label
, uint32_t value
)
520 static const value_string iff_vals
[] = {
522 { WS_IFF_BROADCAST
, "BROADCAST" },
523 { WS_IFF_DEBUG
, "DEBUG" },
524 { WS_IFF_LOOPBACK
, "LOOPBACK" },
525 { WS_IFF_POINTOPOINT
, "POINTOPOINT" },
526 { WS_IFF_NOTRAILERS
, "NOTRAILERS" },
527 { WS_IFF_RUNNING
, "RUNNING" },
528 { WS_IFF_NOARP
, "NOARP" },
529 { WS_IFF_PROMISC
, "PROMISC" },
530 { WS_IFF_ALLMULTI
, "ALLMULTI" },
531 { WS_IFF_MASTER
, "MASTER" },
532 { WS_IFF_SLAVE
, "SLAVE" },
533 { WS_IFF_MULTICAST
, "MULTICAST" },
534 { WS_IFF_PORTSEL
, "PORTSEL" },
535 { WS_IFF_AUTOMEDIA
, "AUTOMEDIA" },
536 { WS_IFF_DYNAMIC
, "DYNAMIC" },
537 { WS_IFF_LOWER_UP
, "LOWER_UP" },
538 { WS_IFF_DORMANT
, "DORMANT" },
539 { WS_IFF_ECHO
, "ECHO" },
545 _fill_label_value_string_bitmask(label
, value
, iff_vals
);
547 snprintf(tmp
, sizeof(tmp
), " (0x%.8x)", value
);
548 (void) g_strlcat(label
, tmp
, ITEM_LABEL_LENGTH
);
552 dissect_netlink_route_ifinfomsg(tvbuff_t
*tvb
, struct netlink_route_info
*info
, struct packet_netlink_data
*nl_data
, proto_tree
*tree
, int offset
)
555 proto_tree
*if_flags_tree
;
557 proto_tree_add_item(tree
, hf_netlink_route_ifi_family
, tvb
, offset
, 1, nl_data
->encoding
);
562 * See the comment for the netlink_route_info structure,
568 /* XXX padding, check if 0 */
571 proto_tree_add_item(tree
, hf_netlink_route_ifi_type
, tvb
, offset
, 2, nl_data
->encoding
);
574 proto_tree_add_item(tree
, hf_netlink_route_ifi_index
, tvb
, offset
, 4, nl_data
->encoding
);
577 ti
= proto_tree_add_item(tree
, hf_netlink_route_ifi_flags
, tvb
, offset
, 4, nl_data
->encoding
);
578 if_flags_tree
= proto_item_add_subtree(ti
, ett_netlink_route_if_flags
);
581 proto_tree_add_item(if_flags_tree
, hf_netlink_route_ifi_flags_iff_up
, tvb
, offset
, 4, nl_data
->encoding
);
582 proto_tree_add_item(if_flags_tree
, hf_netlink_route_ifi_flags_iff_broadcast
, tvb
, offset
, 4, nl_data
->encoding
);
587 proto_tree_add_item(tree
, hf_netlink_route_ifi_change
, tvb
, offset
, 4, nl_data
->encoding
);
593 /* Interface Attributes */
595 static const value_string netlink_route_ifla_attr_vals
[] = {
596 { WS_IFLA_UNSPEC
, "Unspecified" },
597 { WS_IFLA_ADDRESS
, "HW Address" },
598 { WS_IFLA_BROADCAST
, "Broadcast" },
599 { WS_IFLA_IFNAME
, "Device name" },
600 { WS_IFLA_MTU
, "MTU" },
601 { WS_IFLA_LINK
, "Link type" },
602 { WS_IFLA_QDISC
, "Queueing discipline" },
603 { WS_IFLA_STATS
, "Interface Statistics" },
604 { WS_IFLA_COST
, "Cost" },
605 { WS_IFLA_PRIORITY
, "Priority" },
606 { WS_IFLA_MASTER
, "Master" },
607 { WS_IFLA_WIRELESS
, "Wireless" },
608 { WS_IFLA_PROTINFO
, "Prot info" },
609 { WS_IFLA_TXQLEN
, "TxQueue length"},
610 { WS_IFLA_MAP
, "Map"},
611 { WS_IFLA_WEIGHT
, "Weight"},
612 { WS_IFLA_OPERSTATE
, "Operstate"},
613 { WS_IFLA_LINKMODE
, "Link mode"},
614 { WS_IFLA_LINKINFO
, "Link info"},
615 { WS_IFLA_NET_NS_PID
, "NetNs id"},
616 { WS_IFLA_IFALIAS
, "Ifalias"},
617 { WS_IFLA_NUM_VF
, "Num VF"},
618 { WS_IFLA_VFINFO_LIST
, "VF Info"},
619 { WS_IFLA_STATS64
, "Stats" },
620 { WS_IFLA_VF_PORTS
, "VF ports" },
621 { WS_IFLA_PORT_SELF
, "Port self" },
622 { WS_IFLA_AF_SPEC
, "AF spec" },
623 { WS_IFLA_GROUP
, "Group" },
624 { WS_IFLA_NET_NS_FD
, "NetNs fd" },
625 { WS_IFLA_EXT_MASK
, "Ext mask" },
626 { WS_IFLA_PROMISCUITY
, "Promiscuity" },
627 { WS_IFLA_NUM_TX_QUEUES
, "Number of Tx queues" },
628 { WS_IFLA_NUM_RX_QUEUES
, "Number of Rx queues" },
629 { WS_IFLA_CARRIER
, "Carrier" },
630 { WS_IFLA_PHYS_PORT_ID
, "Physical port ID" },
631 { WS_IFLA_CARRIER_CHANGES
,"Carrier changes" },
632 { WS_IFLA_PHYS_SWITCH_ID
, "Physical switch ID" },
633 { WS_IFLA_LINK_NETNSID
, "Link network namespace ID" },
634 { WS_IFLA_PHYS_PORT_NAME
, "Physical port name" },
635 { WS_IFLA_PROTO_DOWN
, "IFLA_PROTO_DOWN" },
636 { WS_IFLA_GSO_MAX_SEGS
, "Maximum GSO segment count" },
637 { WS_IFLA_GSO_MAX_SIZE
, "Maximum GSO size" },
638 { WS_IFLA_PAD
, "IFLA_PAD" },
639 { WS_IFLA_XDP
, "IFLA_XDP" },
640 { WS_IFLA_EVENT
, "IFLA_EVENT" },
641 { WS_IFLA_NEW_NETNSID
, "IFLA_NEW_NETNSID" },
642 { WS_IFLA_IF_NETNSID
, "IFLA_IF_NETNSID" },
643 { WS_IFLA_CARRIER_UP_COUNT
, "Carrier up count" },
644 { WS_IFLA_CARRIER_DOWN_COUNT
, "Carrier down count" },
645 { WS_IFLA_NEW_IFINDEX
, "IFLA_NEW_IFINDEX" },
646 { WS_IFLA_MIN_MTU
, "Minimum MTU" },
647 { WS_IFLA_MAX_MTU
, "Maximum MTU" },
648 { WS_IFLA_PROP_LIST
, "Property list" },
649 { WS_IFLA_ALT_IFNAME
, "Alternative ifname" },
650 { WS_IFLA_PERM_ADDRESS
, "Permanent address" },
651 { WS_IFLA_PROTO_DOWN_REASON
, "Protocol down reason" },
652 { WS_IFLA_PARENT_DEV_NAME
, "Parent device name" },
653 { WS_IFLA_PARENT_DEV_BUS_NAME
, "Parent device bus name" },
654 { WS_IFLA_GRO_MAX_SIZE
, "GRO maximum size" },
655 { WS_IFLA_TSO_MAX_SIZE
, "TSO maximum size" },
656 { WS_IFLA_TSO_MAX_SEGS
, "TSO maximum number of segments" },
657 { WS_IFLA_ALLMULTI
, "Allmulti count" },
661 static const value_string netlink_route_ifla_operstate_vals
[] = {
662 { WS_IF_OPER_UNKNOWN
, "Unknown" },
663 { WS_IF_OPER_NOTPRESENT
, "Not present" },
664 { WS_IF_OPER_DOWN
, "Down" },
665 { WS_IF_OPER_LOWERLAYERDOWN
, "Lower layer down" },
666 { WS_IF_OPER_TESTING
, "Testing" },
667 { WS_IF_OPER_DORMANT
, "Dormant" },
668 { WS_IF_OPER_UP
, "Up"},
672 static int *linkstat_root_hfs
[] = {
673 &hf_netlink_route_ifla_linkstats_rxpackets
,
674 &hf_netlink_route_ifla_linkstats_txpackets
,
675 &hf_netlink_route_ifla_linkstats_rxbytes
,
676 &hf_netlink_route_ifla_linkstats_txbytes
,
677 &hf_netlink_route_ifla_linkstats_rxerrors
,
678 &hf_netlink_route_ifla_linkstats_txerrors
,
679 &hf_netlink_route_ifla_linkstats_rxdropped
,
680 &hf_netlink_route_ifla_linkstats_txdropped
,
681 &hf_netlink_route_ifla_linkstats_multicast
,
682 &hf_netlink_route_ifla_linkstats_collisions
,
686 static int *linkstat_rxerr_hfs
[] = {
687 &hf_netlink_route_ifla_linkstats_rx_len_errs
,
688 &hf_netlink_route_ifla_linkstats_rx_over_errs
,
689 &hf_netlink_route_ifla_linkstats_rx_crc_errs
,
690 &hf_netlink_route_ifla_linkstats_rx_frame_errs
,
691 &hf_netlink_route_ifla_linkstats_rx_fifo_errs
,
692 &hf_netlink_route_ifla_linkstats_rx_miss_errs
,
696 static int *linkstat_txerr_hfs
[] = {
697 &hf_netlink_route_ifla_linkstats_tx_abort_errs
,
698 &hf_netlink_route_ifla_linkstats_tx_carrier_errs
,
699 &hf_netlink_route_ifla_linkstats_tx_fifo_errs
,
700 &hf_netlink_route_ifla_linkstats_tx_heartbeat_errs
,
701 &hf_netlink_route_ifla_linkstats_tx_window_errs
,
705 dissect_netlink_route_ifla_linkstats(tvbuff_t
*tvb
, struct netlink_route_info
*info _U_
, struct packet_netlink_data
*nl_data
, proto_tree
*tree
, int offset
, int byte_size
)
707 proto_tree
* rxerr_subtree
;
708 const int rxerr_hfs_len
= array_length(linkstat_rxerr_hfs
);
709 proto_tree
* txerr_subtree
;
710 const int txerr_hfs_len
= array_length(linkstat_txerr_hfs
);
712 for (size_t i
= 0; i
< array_length(linkstat_root_hfs
); i
++) {
713 proto_tree_add_item(tree
, *linkstat_root_hfs
[i
], tvb
, offset
, byte_size
, nl_data
->encoding
);
717 rxerr_subtree
= proto_tree_add_subtree(tree
, tvb
, offset
, byte_size
* rxerr_hfs_len
, ett_netlink_route_attr_linkstats_rxerrs
, NULL
, "Rx errors");
718 for (int i
= 0; i
< rxerr_hfs_len
; i
++) {
719 proto_tree_add_item(rxerr_subtree
, *linkstat_rxerr_hfs
[i
], tvb
, offset
, byte_size
, nl_data
->encoding
);
723 txerr_subtree
= proto_tree_add_subtree(tree
, tvb
, offset
, byte_size
* txerr_hfs_len
, ett_netlink_route_attr_linkstats_txerrs
, NULL
, "Tx errors");
724 for (int i
= 0; i
< txerr_hfs_len
; i
++) {
725 proto_tree_add_item(txerr_subtree
, *linkstat_txerr_hfs
[i
], tvb
, offset
, byte_size
, nl_data
->encoding
);
734 dissect_netlink_route_ifla_attrs(tvbuff_t
*tvb
, void *data
, struct packet_netlink_data
*nl_data
, proto_tree
*tree
, int rta_type
, int offset
, int len
)
736 struct netlink_route_info
*info
= (struct netlink_route_info
*)data
;
737 enum ws_ifla_attr_type type
= (enum ws_ifla_attr_type
) rta_type
;
744 proto_tree_add_item_ret_string(tree
, hf_netlink_route_ifla_ifname
, tvb
, offset
, len
, ENC_ASCII
| ENC_NA
, wmem_packet_scope(), &str
);
745 proto_item_append_text(tree
, ": %s", str
);
748 proto_tree_add_item_ret_uint(tree
, hf_netlink_route_ifla_mtu
, tvb
, offset
, len
, nl_data
->encoding
, &value
);
749 proto_item_append_text(tree
, ": %u", value
);
752 proto_tree_add_item_ret_uint(tree
, hf_netlink_route_ifla_txqlen
, tvb
, offset
, len
, nl_data
->encoding
, &value
);
753 proto_item_append_text(tree
, ": %u", value
);
755 case WS_IFLA_OPERSTATE
:
756 proto_tree_add_item(tree
, hf_netlink_route_ifla_operstate
, tvb
, offset
, len
, nl_data
->encoding
);
758 case WS_IFLA_PROMISCUITY
:
759 proto_tree_add_item_ret_uint(tree
, hf_netlink_route_ifla_promiscuity
, tvb
, offset
, len
, nl_data
->encoding
, &value
);
760 proto_item_append_text(tree
, ": %u", value
);
762 case WS_IFLA_NUM_TX_QUEUES
:
763 proto_tree_add_item_ret_uint(tree
, hf_netlink_route_ifla_txqnum
, tvb
, offset
, len
, nl_data
->encoding
, &value
);
764 proto_item_append_text(tree
, ": %u", value
);
766 case WS_IFLA_NUM_RX_QUEUES
:
767 proto_tree_add_item_ret_uint(tree
, hf_netlink_route_ifla_rxqnum
, tvb
, offset
, len
, nl_data
->encoding
, &value
);
768 proto_item_append_text(tree
, ": %u", value
);
771 proto_tree_add_item_ret_uint(tree
, hf_netlink_route_ifla_group
, tvb
, offset
, len
, nl_data
->encoding
, &value
);
772 proto_item_append_text(tree
, ": %u", value
);
774 case WS_IFLA_GSO_MAX_SEGS
:
775 proto_tree_add_item_ret_uint(tree
, hf_netlink_route_ifla_gso_maxsegs
, tvb
, offset
, len
, nl_data
->encoding
, &value
);
776 proto_item_append_text(tree
, ": %u", value
);
778 case WS_IFLA_GSO_MAX_SIZE
:
779 proto_tree_add_item_ret_uint(tree
, hf_netlink_route_ifla_gso_maxsize
, tvb
, offset
, len
, nl_data
->encoding
, &value
);
780 proto_item_append_text(tree
, ": %u", value
);
782 case WS_IFLA_CARRIER
:
783 proto_tree_add_item_ret_boolean(tree
, hf_netlink_route_ifla_carrier
, tvb
, offset
, len
, nl_data
->encoding
, &flag
);
784 proto_item_append_text(tree
, ": %s", tfs_get_string(flag
, &tfs_restricted_not_restricted
));
786 case WS_IFLA_CARRIER_CHANGES
:
787 proto_tree_add_item_ret_uint(tree
, hf_netlink_route_ifla_carrier_changes
, tvb
, offset
, len
, nl_data
->encoding
, &value
);
788 proto_item_append_text(tree
, ": %u", value
);
790 case WS_IFLA_ADDRESS
:
791 proto_item_append_text(tree
, ": %s", tvb_bytes_to_str_punct(wmem_packet_scope(), tvb
, offset
, len
, ':'));
792 proto_tree_add_item(tree
, hf_netlink_route_ifla_hwaddr
, tvb
, offset
, len
, nl_data
->encoding
);
794 case WS_IFLA_BROADCAST
:
795 proto_item_append_text(tree
, ": %s", tvb_bytes_to_str_punct(wmem_packet_scope(), tvb
, offset
, len
, ':'));
796 proto_tree_add_item(tree
, hf_netlink_route_ifla_broadcast
, tvb
, offset
, len
, nl_data
->encoding
);
799 subtree
= proto_tree_add_subtree(tree
, tvb
, offset
, len
, ett_netlink_route_attr_linkstats
, NULL
, "Statistics");
800 return dissect_netlink_route_ifla_linkstats(tvb
, info
, nl_data
, subtree
, offset
, 4);
801 case WS_IFLA_STATS64
:
802 subtree
= proto_tree_add_subtree(tree
, tvb
, offset
, len
, ett_netlink_route_attr_linkstats
, NULL
, "Statistics");
803 return dissect_netlink_route_ifla_linkstats(tvb
, info
, nl_data
, subtree
, offset
, 8);
805 proto_tree_add_item_ret_string(tree
, hf_netlink_route_ifla_qdisc
, tvb
, offset
, len
, ENC_ASCII
| ENC_NA
, wmem_packet_scope(), &str
);
806 proto_item_append_text(tree
, ": %s", str
);
809 proto_tree_add_item(tree
, hf_netlink_route_ifla_map_memstart
, tvb
, offset
, 8, nl_data
->encoding
);
810 proto_tree_add_item(tree
, hf_netlink_route_ifla_map_memend
, tvb
, offset
+ 8, 8, nl_data
->encoding
);
811 proto_tree_add_item(tree
, hf_netlink_route_ifla_map_baseaddr
, tvb
, offset
+ 16, 8, nl_data
->encoding
);
812 proto_tree_add_item(tree
, hf_netlink_route_ifla_map_irq
, tvb
, offset
+ 24, 2, nl_data
->encoding
);
813 proto_tree_add_item(tree
, hf_netlink_route_ifla_map_dma
, tvb
, offset
+ 26, 1, nl_data
->encoding
);
814 proto_tree_add_item(tree
, hf_netlink_route_ifla_map_port
, tvb
, offset
+ 27, 1, nl_data
->encoding
);
816 case WS_IFLA_CARRIER_UP_COUNT
:
817 proto_tree_add_item_ret_uint(tree
, hf_netlink_route_ifla_carrier_up_count
, tvb
, offset
, len
, nl_data
->encoding
, &value
);
818 proto_item_append_text(tree
, ": %u", value
);
820 case WS_IFLA_CARRIER_DOWN_COUNT
:
821 proto_tree_add_item_ret_uint(tree
, hf_netlink_route_ifla_carrier_down_count
, tvb
, offset
, len
, nl_data
->encoding
, &value
);
822 proto_item_append_text(tree
, ": %u", value
);
824 case WS_IFLA_MIN_MTU
:
825 proto_tree_add_item_ret_uint(tree
, hf_netlink_route_ifla_min_mtu
, tvb
, offset
, len
, nl_data
->encoding
, &value
);
826 proto_item_append_text(tree
, ": %u", value
);
828 case WS_IFLA_MAX_MTU
:
829 proto_tree_add_item_ret_uint(tree
, hf_netlink_route_ifla_max_mtu
, tvb
, offset
, len
, nl_data
->encoding
, &value
);
830 proto_item_append_text(tree
, ": %u", value
);
841 netlink_route_ifa_flags_label(char *label
, uint32_t value
)
843 static const value_string iff_vals
[] = {
844 { WS_IFA_F_SECONDARY
, "secondary/temporary" },
845 { WS_IFA_F_NODAD
, "nodad" },
846 { WS_IFA_F_OPTIMISTIC
, "optimistic" },
847 { WS_IFA_F_DADFAILED
, "dadfailed" },
848 { WS_IFA_F_HOMEADDRESS
, "homeaddress" },
849 { WS_IFA_F_DEPRECATED
, "deprecated" },
850 { WS_IFA_F_TENTATIVE
, "tentative" },
851 { WS_IFA_F_PERMANENT
, "permanent" },
852 /* 32-bit IFA_FLAGS (in attribute) */
853 { WS_IFA_F_MANAGETEMPADDR
, "mngtmpaddr" },
854 { WS_IFA_F_NOPREFIXROUTE
, "noprefixroute" },
855 { WS_IFA_F_MCAUTOJOIN
, "autojoin" },
856 { WS_IFA_F_STABLE_PRIVACY
, "stable_privacy" },
862 _fill_label_value_string_bitmask(label
, value
, iff_vals
);
864 snprintf(tmp
, sizeof(tmp
), " (0x%.8x)", value
);
865 (void) g_strlcat(label
, tmp
, ITEM_LABEL_LENGTH
);
869 dissect_netlink_route_ifaddrmsg(tvbuff_t
*tvb
, struct netlink_route_info
*info
, struct packet_netlink_data
*nl_data
, proto_tree
*tree
, int offset
)
871 proto_tree_add_item(tree
, hf_netlink_route_ifa_family
, tvb
, offset
, 1, ENC_NA
);
876 * See the comment for the netlink_route_info structure,
882 proto_tree_add_item(tree
, hf_netlink_route_ifa_prefixlen
, tvb
, offset
, 1, ENC_NA
);
885 proto_tree_add_item(tree
, hf_netlink_route_ifa_flags
, tvb
, offset
, 1, ENC_NA
);
888 proto_tree_add_item(tree
, hf_netlink_route_ifa_scope
, tvb
, offset
, 1, ENC_NA
);
891 proto_tree_add_item(tree
, hf_netlink_route_ifa_index
, tvb
, offset
, 4, nl_data
->encoding
);
897 /* IP address attributes */
899 static const value_string netlink_route_ifa_attr_vals
[] = {
900 { WS_IFA_UNSPEC
, "Unspecified" },
901 { WS_IFA_ADDRESS
, "Interface address" },
902 { WS_IFA_LOCAL
, "Local address" },
903 { WS_IFA_LABEL
, "Name of interface" },
904 { WS_IFA_BROADCAST
, "Broadcast address" },
905 { WS_IFA_ANYCAST
, "Anycast address" },
906 { WS_IFA_CACHEINFO
, "Address information" },
907 { WS_IFA_MULTICAST
, "Multicast address" },
908 { WS_IFA_FLAGS
, "Address flags" },
909 { WS_IFA_RT_PRIORITY
, "IFA_RT_PRIORITY" },
910 { WS_IFA_TARGET_NETNSID
, "IFA_TARGET_NETNSID" },
911 { WS_IFA_PROTO
, "IFA_PROTO" },
916 dissect_netlink_route_ifa_attrs(tvbuff_t
*tvb
, void *data _U_
, struct packet_netlink_data
*nl_data
, proto_tree
*tree
, int rta_type
, int offset
, int len
)
918 enum ws_ifa_attr_type type
= (enum ws_ifa_attr_type
) rta_type
;
923 proto_tree_add_item_ret_string(tree
, hf_netlink_route_ifa_label
, tvb
, offset
, len
, ENC_ASCII
| ENC_NA
, wmem_packet_scope(), &str
);
924 proto_item_append_text(tree
, ": %s", str
);
928 proto_tree_add_item(tree
, hf_netlink_route_ifa_flags32
, tvb
, offset
, 4, nl_data
->encoding
);
932 case WS_IFA_BROADCAST
:
934 proto_item_append_text(tree
, ": %s", tvb_ip_to_str(wmem_packet_scope(), tvb
, offset
));
935 proto_tree_add_item(tree
, hf_netlink_route_ifa_addr4
, tvb
, offset
, len
, ENC_BIG_ENDIAN
);
937 proto_item_append_text(tree
, ": %s", tvb_ip6_to_str(wmem_packet_scope(), tvb
, offset
));
938 proto_tree_add_item(tree
, hf_netlink_route_ifa_addr6
, tvb
, offset
, len
, ENC_NA
);
948 static const value_string netlink_route_rt_protocol_vals
[] = {
949 { WS_RTPROT_UNSPEC
, "unknown" },
950 { WS_RTPROT_REDIRECT
, "ICMP redirects" },
951 { WS_RTPROT_KERNEL
, "kernel" },
952 { WS_RTPROT_BOOT
, "boot" },
953 { WS_RTPROT_STATIC
, "static" },
954 { WS_RTPROT_GATED
, "GateD" },
955 { WS_RTPROT_RA
, "RDISC/ND router advertisements" },
956 { WS_RTPROT_MRT
, "Merit MRT" },
957 { WS_RTPROT_ZEBRA
, "Zebra" },
958 { WS_RTPROT_BIRD
, "BIRD" },
959 { WS_RTPROT_DNROUTED
, "DECnet routing daemon" },
960 { WS_RTPROT_XORP
, "XORP" },
961 { WS_RTPROT_NTK
, "Netsukuku" },
962 { WS_RTPROT_DHCP
, "DHCP client" },
963 { WS_RTPROT_MROUTED
, "Multicast daemon" },
964 { WS_RTPROT_KEEPALIVED
, "Keepalived daemon" },
965 { WS_RTPROT_BABEL
, "Babel daemon" },
966 { WS_RTPROT_OPENR
, "Open Routing Routes" },
967 { WS_RTPROT_BGP
, "BGP" },
968 { WS_RTPROT_ISIS
, "ISIS" },
969 { WS_RTPROT_OSPF
, "OSPF" },
970 { WS_RTPROT_RIP
, "RIP" },
971 { WS_RTPROT_EIGRP
, "EIGRP" },
974 static value_string_ext hf_netlink_route_rt_protocol_vals_ext
=
975 VALUE_STRING_EXT_INIT(netlink_route_rt_protocol_vals
);
977 static const value_string netlink_route_rt_scope_vals
[] = {
978 { WS_RT_SCOPE_UNIVERSE
, "global route" },
979 { WS_RT_SCOPE_SITE
, "interior route in the local autonomous system" },
980 { WS_RT_SCOPE_LINK
, "route on this link" },
981 { WS_RT_SCOPE_HOST
, "route on the local host" },
982 { WS_RT_SCOPE_NOWHERE
, "destination doesn't exist" },
986 static const value_string netlink_route_rt_type_vals
[] = {
987 { WS_RTN_UNSPEC
, "Unknown route" },
988 { WS_RTN_UNICAST
, "Gateway or direct route" },
989 { WS_RTN_LOCAL
, "Local interface route" },
990 { WS_RTN_BROADCAST
, "Local broadcast route (send as broadcast)" },
991 { WS_RTN_ANYCAST
, "Local broadcast route (send as unicast)" },
992 { WS_RTN_MULTICAST
, "Multicast route" },
993 { WS_RTN_BLACKHOLE
, "Drop" },
994 { WS_RTN_UNREACHABLE
, "Unreachable destination" },
995 { WS_RTN_PROHIBIT
, "Administratively prohibited" },
996 { WS_RTN_THROW
, "Routing lookup in another table" },
997 { WS_RTN_NAT
, "Network address translation rule" },
998 { WS_RTN_XRESOLVE
, "Use external resolver" },
1003 dissect_netlink_route_rtmsg(tvbuff_t
*tvb
, struct netlink_route_info
*info
, struct packet_netlink_data
*nl_data
, proto_tree
*tree
, int offset
)
1005 proto_tree_add_item(tree
, hf_netlink_route_rt_family
, tvb
, offset
, 1, ENC_NA
);
1010 * See the comment for the netlink_route_info structure,
1016 proto_tree_add_item(tree
, hf_netlink_route_rt_dst_len
, tvb
, offset
, 1, ENC_NA
);
1019 proto_tree_add_item(tree
, hf_netlink_route_rt_src_len
, tvb
, offset
, 1, ENC_NA
);
1022 proto_tree_add_item(tree
, hf_netlink_route_rt_tos
, tvb
, offset
, 1, ENC_NA
);
1025 proto_tree_add_item(tree
, hf_netlink_route_rt_table
, tvb
, offset
, 1, ENC_NA
);
1028 proto_tree_add_item(tree
, hf_netlink_route_rt_protocol
, tvb
, offset
, 1, ENC_NA
);
1031 proto_tree_add_item(tree
, hf_netlink_route_rt_scope
, tvb
, offset
, 1, ENC_NA
);
1034 proto_tree_add_item(tree
, hf_netlink_route_rt_type
, tvb
, offset
, 1, ENC_NA
);
1037 proto_tree_add_item(tree
, hf_netlink_route_rt_flags
, tvb
, offset
, 4, nl_data
->encoding
);
1043 /* Route Attributes */
1045 static const value_string netlink_route_rta_attr_vals
[] = {
1046 { WS_RTA_UNSPEC
, "Unspecified" },
1047 { WS_RTA_DST
, "Route destination address" },
1048 { WS_RTA_SRC
, "Route source address" },
1049 { WS_RTA_IIF
, "Input interface index" },
1050 { WS_RTA_OIF
, "Output interface index" },
1051 { WS_RTA_GATEWAY
, "Gateway of the route" },
1052 { WS_RTA_PRIORITY
, "RTA_PRIORITY" },
1053 { WS_RTA_PREFSRC
, "RTA_PREFSRC" },
1054 { WS_RTA_METRICS
, "RTA_METRICS" },
1055 { WS_RTA_MULTIPATH
, "RTA_MULTIPATH" },
1056 { WS_RTA_PROTOINFO
, "RTA_PROTOINFO" },
1057 { WS_RTA_FLOW
, "RTA_FLOW" },
1058 { WS_RTA_CACHEINFO
, "RTA_CACHEINFO" },
1059 { WS_RTA_SESSION
, "RTA_SESSION" },
1060 { WS_RTA_MP_ALGO
, "RTA_MP_ALGO" },
1061 { WS_RTA_TABLE
, "RTA_TABLE" },
1062 { WS_RTA_MARK
, "RTA_MARK" },
1063 { WS_RTA_MFC_STATS
, "RTA_MFC_STATS" },
1064 { WS_RTA_VIA
, "RTA_VIA" },
1065 { WS_RTA_NEWDST
, "RTA_NEWDST" },
1066 { WS_RTA_PREF
, "RTA_PREF" },
1067 { WS_RTA_ENCAP_TYPE
,"RTA_ENCAP_TYPE" },
1068 { WS_RTA_ENCAP
, "RTA_ENCAP" },
1069 { WS_RTA_EXPIRES
, "RTA_EXPIRES" },
1070 { WS_RTA_PAD
, "RTA_PAD" },
1071 { WS_RTA_UID
, "RTA_UID" },
1072 { WS_RTA_TTL_PROPAGATE
, "RTA_TTL_PROPAGATE" },
1073 { WS_RTA_IP_PROTO
, "RTA_IP_PROTO" },
1074 { WS_RTA_SPORT
, "RTA_SPORT" },
1075 { WS_RTA_DPORT
, "RTA_DPORT" },
1076 { WS_RTA_NH_ID
, "RTA_NH_ID" },
1081 dissect_netlink_route_route_attrs(tvbuff_t
*tvb
, void *data _U_
, struct packet_netlink_data
*nl_data
, proto_tree
*tree
, int rta_type
, int offset
, int len
)
1083 enum ws_rta_attr_type type
= (enum ws_rta_attr_type
) rta_type
;
1089 proto_tree_add_item_ret_uint(tree
, hf_netlink_route_rta_iif
, tvb
, offset
, 4, nl_data
->encoding
, &value
);
1090 proto_item_append_text(tree
, ": %u", value
);
1097 proto_tree_add_item_ret_uint(tree
, hf_netlink_route_rta_oif
, tvb
, offset
, 4, nl_data
->encoding
, &value
);
1098 proto_item_append_text(tree
, ": %u", value
);
1109 netlink_route_nd_states_label(char *label
, uint32_t value
)
1111 static const value_string flags_vals
[] = {
1112 { WS_NUD_NONE
, "NONE" },
1113 { WS_NUD_INCOMPLETE
, "INCOMPLETE" },
1114 { WS_NUD_REACHABLE
, "REACHABLE" },
1115 { WS_NUD_STALE
, "STALE" },
1116 { WS_NUD_DELAY
, "DELAY" },
1117 { WS_NUD_PROBE
, "PROBE" },
1118 { WS_NUD_FAILED
, "FAILED" },
1119 { WS_NUD_NOARP
, "NOARP" },
1120 { WS_NUD_PERMANENT
, "PERMANENT" },
1126 _fill_label_value_string_bitmask(label
, value
, flags_vals
);
1128 snprintf(tmp
, sizeof(tmp
), " (0x%.4x)", value
);
1129 (void) g_strlcat(label
, tmp
, ITEM_LABEL_LENGTH
);
1133 dissect_netlink_route_ndmsg(tvbuff_t
*tvb
, struct netlink_route_info
*info
, struct packet_netlink_data
*nl_data
, proto_tree
*tree
, int offset
)
1135 proto_tree_add_item(tree
, hf_netlink_route_nd_family
, tvb
, offset
, 1, ENC_NA
);
1140 * See the comment for the netlink_route_info structure,
1146 /* XXX, 3B padding */
1149 proto_tree_add_item(tree
, hf_netlink_route_nd_index
, tvb
, offset
, 4, nl_data
->encoding
);
1152 proto_tree_add_item(tree
, hf_netlink_route_nd_state
, tvb
, offset
, 2, nl_data
->encoding
);
1155 proto_tree_add_item(tree
, hf_netlink_route_nd_flags
, tvb
, offset
, 1, ENC_NA
);
1158 proto_tree_add_item(tree
, hf_netlink_route_nd_type
, tvb
, offset
, 1, ENC_NA
);
1164 static const value_string netlink_route_type_vals
[] = {
1165 { WS_RTM_NEWLINK
, "Create network interface" },
1166 { WS_RTM_DELLINK
, "Remove network interface" },
1167 { WS_RTM_GETLINK
, "Get network interface info" },
1168 { WS_RTM_SETLINK
, "Set network interface info" },
1169 { WS_RTM_NEWADDR
, "Add IP address" },
1170 { WS_RTM_DELADDR
, "Delete IP address" },
1171 { WS_RTM_GETADDR
, "Get IP address" },
1172 { WS_RTM_NEWROUTE
, "Add network route" },
1173 { WS_RTM_DELROUTE
, "Delete network route" },
1174 { WS_RTM_GETROUTE
, "Get network route" },
1175 { WS_RTM_NEWNEIGH
, "Add neighbor table entry" },
1176 { WS_RTM_DELNEIGH
, "Delete neighbor table entry" },
1177 { WS_RTM_GETNEIGH
, "Get neighbor table entry" },
1178 { WS_RTM_NEWRULE
, "Add routing rule" },
1179 { WS_RTM_DELRULE
, "Delete routing rule" },
1180 { WS_RTM_GETRULE
, "Get routing rule" },
1181 { WS_RTM_NEWQDISC
, "Add queueing discipline" },
1182 { WS_RTM_DELQDISC
, "Delete queueing discipline" },
1183 { WS_RTM_GETQDISC
, "Get queueing discipline" },
1184 { WS_RTM_NEWTCLASS
, "Add traffic class" },
1185 { WS_RTM_DELTCLASS
, "Delete traffic class" },
1186 { WS_RTM_GETTCLASS
, "Get traffic class" },
1187 { WS_RTM_NEWTFILTER
, "Add traffic class" },
1188 { WS_RTM_DELTFILTER
, "Delete traffic class" },
1189 { WS_RTM_GETTFILTER
, "Get traffic class" },
1190 { WS_RTM_NEWACTION
, "New Action" },
1191 { WS_RTM_DELACTION
, "Delete Action" },
1192 { WS_RTM_GETACTION
, "Get Action" },
1193 { WS_RTM_NEWPREFIX
, "New IPv6 prefix" },
1194 { WS_RTM_GETMULTICAST
, "Get multicast address" },
1195 { WS_RTM_GETANYCAST
, "Get anycast address" },
1196 { WS_RTM_NEWNEIGHTBL
, "New Neighbour tables" },
1197 { WS_RTM_GETNEIGHTBL
, "Get Neighbour tables" },
1198 { WS_RTM_SETNEIGHTBL
, "Set Neighbour tables" },
1199 { WS_RTM_NEWNDUSEROPT
, "New ND Userland options" },
1200 { WS_RTM_NEWADDRLABEL
, "New IPv6 Address Label" },
1201 { WS_RTM_DELADDRLABEL
, "Delete IPv6 Address Label" },
1202 { WS_RTM_GETADDRLABEL
, "Get IPv6 Address Label" },
1203 { WS_RTM_GETDCB
, "Get Data Center Bridging" },
1204 { WS_RTM_SETDCB
, "Set Data Center Bridging" },
1205 { WS_RTM_NEWNETCONF
, "RTM_NEWNETCONF" },
1206 { WS_RTM_DELNETCONF
, "RTM_DELNETCONF" },
1207 { WS_RTM_GETNETCONF
, "RTM_GETNETCONF" },
1208 { WS_RTM_NEWMDB
, "Add multicast database entry" },
1209 { WS_RTM_DELMDB
, "Delete multicast database entry" },
1210 { WS_RTM_GETMDB
, "Get multicast database" },
1211 { WS_RTM_NEWNSID
, "New network namespace ID" },
1212 { WS_RTM_DELNSID
, "Delete network namespace ID" },
1213 { WS_RTM_GETNSID
, "Get network namespace ID" },
1214 { WS_RTM_NEWSTATS
, "New link statistics" },
1215 { WS_RTM_GETSTATS
, "Get link statistics" },
1216 { WS_RTM_NEWCACHEREPORT
,"New cache report" },
1217 { WS_RTM_NEWCHAIN
, "New chain" },
1218 { WS_RTM_DELCHAIN
, "Delete chain" },
1219 { WS_RTM_GETCHAIN
, "Get chain" },
1220 { WS_RTM_NEWNEXTHOP
, "New next hop" },
1221 { WS_RTM_DELNEXTHOP
, "Delete next hop" },
1222 { WS_RTM_GETNEXTHOP
, "Get next hop" },
1223 { WS_RTM_NEWLINKPROP
, "New link property" },
1224 { WS_RTM_DELLINKPROP
, "Delete link property" },
1225 { WS_RTM_GETLINKPROP
, "Get link property" },
1226 { WS_RTM_NEWVLAN
, "New VLAN" },
1227 { WS_RTM_DELVLAN
, "Delete VLAN" },
1228 { WS_RTM_GETVLAN
, "Get VLAN" },
1229 { WS_RTM_NEWNEXTHOPBUCKET
, "New next hop bucket" },
1230 { WS_RTM_DELNEXTHOPBUCKET
, "Delete next hop bucket" },
1231 { WS_RTM_GETNEXTHOPBUCKET
, "Get next hop bucket" },
1232 { WS_RTM_NEWTUNNEL
, "New tunnel" },
1233 { WS_RTM_DELTUNNEL
, "Delete tunnel" },
1234 { WS_RTM_GETTUNNEL
, "Get tunnel" },
1237 static value_string_ext netlink_route_type_vals_ext
= VALUE_STRING_EXT_INIT(netlink_route_type_vals
);
1240 dissect_netlink_route(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data
)
1242 struct netlink_route_info info
;
1243 struct packet_netlink_data
*nl_data
= (struct packet_netlink_data
*)data
;
1244 proto_tree
*nlmsg_tree
;
1248 DISSECTOR_ASSERT(nl_data
&& nl_data
->magic
== PACKET_NETLINK_MAGIC
);
1250 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "Netlink route");
1251 col_clear(pinfo
->cinfo
, COL_INFO
);
1253 pi
= proto_tree_add_item(tree
, proto_netlink_route
, tvb
, 0, -1, ENC_NA
);
1254 nlmsg_tree
= proto_item_add_subtree(pi
, ett_netlink_route
);
1256 /* Netlink message header (nlmsghdr) */
1257 offset
= dissect_netlink_header(tvb
, nlmsg_tree
, offset
, nl_data
->encoding
, hf_netlink_route_nltype
, NULL
);
1261 switch (nl_data
->type
) {
1262 case WS_RTM_NEWLINK
:
1263 case WS_RTM_DELLINK
:
1264 case WS_RTM_GETLINK
:
1265 case WS_RTM_SETLINK
:
1267 * Backward compatibility with legacy tools; 16 is
1268 * sizeof(struct ifinfomsg).
1270 * See the comment for the netlink_route_info
1273 info
.legacy
= (nl_data
->type
== WS_RTM_GETLINK
) && (tvb_reported_length_remaining(tvb
, offset
) < 16);
1274 offset
= dissect_netlink_route_ifinfomsg(tvb
, &info
, nl_data
, nlmsg_tree
, offset
);
1275 /* Optional attributes */
1276 offset
= dissect_netlink_route_attributes(tvb
, hf_netlink_route_ifla_attr_type
, &info
, nl_data
, nlmsg_tree
, offset
, dissect_netlink_route_ifla_attrs
);
1279 case WS_RTM_NEWADDR
:
1280 case WS_RTM_DELADDR
:
1281 case WS_RTM_GETADDR
:
1283 * Backward compatibility with legacy tools; 8 is
1284 * sizeof(struct ifaddrmsg).
1286 * See the comment for the netlink_route_info
1289 info
.legacy
= (nl_data
->type
== WS_RTM_GETADDR
) && (tvb_reported_length_remaining(tvb
, offset
) < 8);
1290 offset
= dissect_netlink_route_ifaddrmsg(tvb
, &info
, nl_data
, nlmsg_tree
, offset
);
1293 * Optional attributes.
1295 * Not present in legacy-tool messages;
1296 * again, see the comment above.
1298 offset
= dissect_netlink_route_attributes(tvb
, hf_netlink_route_ifa_attr_type
, &info
, nl_data
, nlmsg_tree
, offset
, dissect_netlink_route_ifa_attrs
);
1302 case WS_RTM_NEWROUTE
:
1303 case WS_RTM_DELROUTE
:
1304 case WS_RTM_GETROUTE
:
1306 * Backward compatibility with legacy tools; 12 is
1307 * sizeof(struct rtmsg).
1309 * See the comment for the netlink_route_info
1312 info
.legacy
= (nl_data
->type
== WS_RTM_GETROUTE
) && (tvb_reported_length_remaining(tvb
, offset
) < 12);
1313 offset
= dissect_netlink_route_rtmsg(tvb
, &info
, nl_data
, nlmsg_tree
, offset
);
1314 /* Optional attributes */
1317 * Optional attributes.
1319 * Not present in legacy-tool messages;
1320 * again, see the comment above.
1322 offset
= dissect_netlink_route_attributes(tvb
, hf_netlink_route_rta_attr_type
, &info
, nl_data
, nlmsg_tree
, offset
, dissect_netlink_route_route_attrs
);
1326 case WS_RTM_NEWNEIGH
:
1327 case WS_RTM_DELNEIGH
:
1328 case WS_RTM_GETNEIGH
:
1330 * Backward compatibility with legacy tools; 12 is
1331 * sizeof(struct ndmsg).
1333 * See the comment for the netlink_route_info
1336 info
.legacy
= (nl_data
->type
== WS_RTM_GETNEIGH
) && (tvb_reported_length_remaining(tvb
, offset
) < 12);
1339 * Optional attributes.
1341 * Not present in legacy-tool messages;
1342 * again, see the comment above.
1344 offset
= dissect_netlink_route_ndmsg(tvb
, &info
, nl_data
, nlmsg_tree
, offset
);
1353 proto_register_netlink_route(void)
1355 static hf_register_info hf
[] = {
1356 { &hf_netlink_route_ifi_family
,
1357 { "Interface family", "netlink-route.ifi_family",
1358 FT_UINT8
, BASE_DEC
, NULL
, 0x00,
1361 { &hf_netlink_route_ifi_type
,
1362 { "Device type", "netlink-route.ifi_type",
1363 FT_UINT16
, BASE_DEC
, VALS(arp_hrd_vals
), 0x00,
1366 { &hf_netlink_route_ifi_index
,
1367 { "Interface index", "netlink-route.ifi_index",
1368 FT_INT32
, BASE_DEC
, NULL
, 0x00,
1371 { &hf_netlink_route_ifi_flags
,
1372 { "Device flags", "netlink-route.ifi_flags",
1373 FT_UINT32
, BASE_CUSTOM
, CF_FUNC(hf_netlink_route_ifi_flags_label
), 0x00,
1376 { &hf_netlink_route_ifi_flags_iff_up
,
1377 { "Interface", "netlink-route.ifi_flags.iff_up",
1378 FT_BOOLEAN
, 32, TFS(&tfs_up_down
), WS_IFF_UP
,
1381 { &hf_netlink_route_ifi_flags_iff_broadcast
,
1382 { "Broadcast", "netlink-route.ifi_flags.iff_broadcast",
1383 FT_BOOLEAN
, 32, TFS(&tfs_valid_invalid
), WS_IFF_BROADCAST
,
1386 { &hf_netlink_route_ifi_change
,
1387 { "Device change flags", "netlink-route.ifi_change",
1388 FT_UINT32
, BASE_DEC
, NULL
, 0x00,
1391 { &hf_netlink_route_ifla_attr_type
,
1392 { "Attribute type", "netlink-route.ifla_attr_type",
1393 FT_UINT16
, BASE_DEC
, VALS(netlink_route_ifla_attr_vals
), 0x00,
1396 { &hf_netlink_route_ifla_ifname
,
1397 { "Device name", "netlink-route.ifla_ifname",
1398 FT_STRINGZ
, BASE_NONE
, NULL
, 0x00,
1401 { &hf_netlink_route_ifla_mtu
,
1402 { "MTU of device", "netlink-route.ifla_mtu",
1403 FT_UINT32
, BASE_DEC
, NULL
, 0x00,
1406 { &hf_netlink_route_ifla_txqlen
,
1407 { "TxQueue length", "netlink-route.ifla_txqlen",
1408 FT_UINT32
, BASE_DEC
, NULL
, 0x00,
1411 { &hf_netlink_route_ifla_operstate
,
1412 { "Operstate", "netlink-route.ifla_operstate",
1413 FT_UINT8
, BASE_DEC
, VALS(netlink_route_ifla_operstate_vals
), 0x00,
1416 { &hf_netlink_route_ifla_promiscuity
,
1417 { "Promiscuity", "netlink-route.ifla_promiscuity",
1418 FT_UINT32
, BASE_DEC
, NULL
, 0x00,
1421 { &hf_netlink_route_ifla_txqnum
,
1422 { "Number of Tx queues", "netlink-route.ifla_txqnum",
1423 FT_UINT32
, BASE_DEC
, NULL
, 0x00,
1426 { &hf_netlink_route_ifla_rxqnum
,
1427 { "Number of Rx queues", "netlink-route.ifla_rxqnum",
1428 FT_UINT32
, BASE_DEC
, NULL
, 0x00,
1431 { &hf_netlink_route_ifla_group
,
1432 { "Group", "netlink-route.ifla_group",
1433 FT_UINT32
, BASE_DEC
, NULL
, 0x00,
1436 { &hf_netlink_route_ifla_gso_maxsize
,
1437 { "Maximum GSO size", "netlink-route.ifla_gso_maxsize",
1438 FT_UINT32
, BASE_DEC
, NULL
, 0x00,
1441 { &hf_netlink_route_ifla_gso_maxsegs
,
1442 { "Maximum GSO segment count", "netlink-route.ifla_gso_maxsegs",
1443 FT_UINT32
, BASE_DEC
, NULL
, 0x00,
1446 { &hf_netlink_route_ifla_carrier
,
1447 { "Carrier", "netlink-route.ifla_carrier",
1448 FT_BOOLEAN
, 32, TFS(&tfs_restricted_not_restricted
), 0x00000001,
1451 { &hf_netlink_route_ifla_qdisc
,
1452 { "Queueing discipline", "netlink-route.ifla_qdisc",
1453 FT_STRINGZ
, BASE_NONE
, NULL
, 0x00,
1456 { &hf_netlink_route_ifla_carrier_changes
,
1457 { "Carrier changes", "netlink-route.ifla_carrier_changes",
1458 FT_UINT32
, BASE_DEC
, NULL
, 0x00,
1461 { &hf_netlink_route_ifla_hwaddr
,
1462 { "HW Address", "netlink-route.ifla_hwaddr",
1463 FT_BYTES
, SEP_COLON
, NULL
, 0x00,
1466 { &hf_netlink_route_ifla_broadcast
,
1467 { "Broadcast", "netlink-route.ifla_broadcast",
1468 FT_BYTES
, SEP_COLON
, NULL
, 0x00,
1471 { &hf_netlink_route_ifla_carrier_up_count
,
1472 { "Carrier changes to up", "netlink-route.ifla_carrier_up_count",
1473 FT_UINT32
, BASE_DEC
, NULL
, 0x00,
1476 { &hf_netlink_route_ifla_carrier_down_count
,
1477 { "Carrier changes to down", "netlink-route.ifla_carrier_down_count",
1478 FT_UINT32
, BASE_DEC
, NULL
, 0x00,
1481 { &hf_netlink_route_ifla_min_mtu
,
1482 { "Minimum MTU of device", "netlink-route.ifla_min_mtu",
1483 FT_UINT32
, BASE_DEC
, NULL
, 0x00,
1486 { &hf_netlink_route_ifla_max_mtu
,
1487 { "Maximum MTU of device", "netlink-route.ifla_max_mtu",
1488 FT_UINT32
, BASE_DEC
, NULL
, 0x00,
1491 { &hf_netlink_route_ifla_map_memstart
,
1492 { "Memory start", "netlink-route.ifla_map.mem_start",
1493 FT_UINT64
, BASE_HEX
, NULL
, 0x00,
1496 { &hf_netlink_route_ifla_map_memend
,
1497 { "Memory end", "netlink-route.ifla_map.mem_end",
1498 FT_UINT64
, BASE_HEX
, NULL
, 0x00,
1501 { &hf_netlink_route_ifla_map_baseaddr
,
1502 { "Base address", "netlink-route.ifla_map.base_addr",
1503 FT_UINT64
, BASE_HEX
, NULL
, 0x00,
1506 { &hf_netlink_route_ifla_map_irq
,
1507 { "IRQ", "netlink-route.ifla_map.irq",
1508 FT_UINT16
, BASE_DEC
, NULL
, 0x00,
1511 { &hf_netlink_route_ifla_map_dma
,
1512 { "DMA", "netlink-route.ifla_map.dma",
1513 FT_UINT8
, BASE_DEC
, NULL
, 0x00,
1516 { &hf_netlink_route_ifla_map_port
,
1517 { "Port", "netlink-route.ifla_map.port",
1518 FT_UINT8
, BASE_DEC
, NULL
, 0x00,
1521 { &hf_netlink_route_ifla_linkstats_rxpackets
,
1522 { "Rx packets", "netlink-route.ifla_linkstats.rxpackets",
1523 FT_UINT64
, BASE_DEC
, NULL
, 0x00,
1526 { &hf_netlink_route_ifla_linkstats_txpackets
,
1527 { "Tx packets", "netlink-route.ifla_linkstats.txpackets",
1528 FT_UINT64
, BASE_DEC
, NULL
, 0x00,
1531 { &hf_netlink_route_ifla_linkstats_rxbytes
,
1532 { "Rx bytes", "netlink-route.ifla_linkstats.rxbytes",
1533 FT_UINT64
, BASE_DEC
, NULL
, 0x00,
1536 { &hf_netlink_route_ifla_linkstats_txbytes
,
1537 { "Tx packets", "netlink-route.ifla_linkstats.txbytes",
1538 FT_UINT64
, BASE_DEC
, NULL
, 0x00,
1541 { &hf_netlink_route_ifla_linkstats_rxerrors
,
1542 { "Rx errors", "netlink-route.ifla_linkstats.rxerrors",
1543 FT_UINT64
, BASE_DEC
, NULL
, 0x00,
1546 { &hf_netlink_route_ifla_linkstats_txerrors
,
1547 { "Tx errors", "netlink-route.ifla_linkstats.txerrors",
1548 FT_UINT64
, BASE_DEC
, NULL
, 0x00,
1551 { &hf_netlink_route_ifla_linkstats_rxdropped
,
1552 { "Rx dropped", "netlink-route.ifla_linkstats.rxdropped",
1553 FT_UINT64
, BASE_DEC
, NULL
, 0x00,
1556 { &hf_netlink_route_ifla_linkstats_txdropped
,
1557 { "Tx dropped", "netlink-route.ifla_linkstats.txdropped",
1558 FT_UINT64
, BASE_DEC
, NULL
, 0x00,
1561 { &hf_netlink_route_ifla_linkstats_multicast
,
1562 { "Multicast Rx", "netlink-route.ifla_linkstats.multicast",
1563 FT_UINT64
, BASE_DEC
, NULL
, 0x00,
1566 { &hf_netlink_route_ifla_linkstats_collisions
,
1567 { "Collisions", "netlink-route.ifla_linkstats.collisions",
1568 FT_UINT64
, BASE_DEC
, NULL
, 0x00,
1571 { &hf_netlink_route_ifla_linkstats_rx_len_errs
,
1572 { "Length errors", "netlink-route.ifla_linkstats.rx_errors.length_errs",
1573 FT_UINT64
, BASE_DEC
, NULL
, 0x00,
1576 { &hf_netlink_route_ifla_linkstats_rx_over_errs
,
1577 { "Ring buffer overflow errors", "netlink-route.ifla_linkstats.rx_errors.over_errs",
1578 FT_UINT64
, BASE_DEC
, NULL
, 0x00,
1581 { &hf_netlink_route_ifla_linkstats_rx_crc_errs
,
1582 { "CRC errors", "netlink-route.ifla_linkstats.rx_errors.crc_errs",
1583 FT_UINT64
, BASE_DEC
, NULL
, 0x00,
1586 { &hf_netlink_route_ifla_linkstats_rx_frame_errs
,
1587 { "Frame alignment errors", "netlink-route.ifla_linkstats.rx_errors.frame_errs",
1588 FT_UINT64
, BASE_DEC
, NULL
, 0x00,
1591 { &hf_netlink_route_ifla_linkstats_rx_fifo_errs
,
1592 { "FIFO overrun errors", "netlink-route.ifla_linkstats.rx_errors.fifo_errs",
1593 FT_UINT64
, BASE_DEC
, NULL
, 0x00,
1596 { &hf_netlink_route_ifla_linkstats_rx_miss_errs
,
1597 { "Missed packet errors", "netlink-route.ifla_linkstats.rx_errors.miss_errs",
1598 FT_UINT64
, BASE_DEC
, NULL
, 0x00,
1601 { &hf_netlink_route_ifla_linkstats_tx_abort_errs
,
1602 { "Abort errors", "netlink-route.ifla_linkstats.rx_errors.abort_errs",
1603 FT_UINT64
, BASE_DEC
, NULL
, 0x00,
1606 { &hf_netlink_route_ifla_linkstats_tx_carrier_errs
,
1607 { "Carrier errors", "netlink-route.ifla_linkstats.rx_errors.carrier_errs",
1608 FT_UINT64
, BASE_DEC
, NULL
, 0x00,
1611 { &hf_netlink_route_ifla_linkstats_tx_fifo_errs
,
1612 { "FIFO errors", "netlink-route.ifla_linkstats.rx_errors.fifo_errs",
1613 FT_UINT64
, BASE_DEC
, NULL
, 0x00,
1616 { &hf_netlink_route_ifla_linkstats_tx_heartbeat_errs
,
1617 { "Heartbeat errors", "netlink-route.ifla_linkstats.rx_errors.heartbeat_errs",
1618 FT_UINT64
, BASE_DEC
, NULL
, 0x00,
1621 { &hf_netlink_route_ifla_linkstats_tx_window_errs
,
1622 { "Window errors", "netlink-route.ifla_linkstats.rx_errors.window_errs",
1623 FT_UINT64
, BASE_DEC
, NULL
, 0x00,
1626 { &hf_netlink_route_ifa_family
,
1627 { "Address type", "netlink-route.ifa_family",
1628 FT_UINT8
, BASE_DEC
| BASE_EXT_STRING
, &linux_af_vals_ext
, 0x00,
1631 { &hf_netlink_route_ifa_prefixlen
,
1632 { "Address prefixlength", "netlink-route.ifa_prefixlen",
1633 FT_UINT8
, BASE_DEC
, NULL
, 0x00,
1636 { &hf_netlink_route_ifa_flags
,
1637 { "Address flags", "netlink-route.ifa_flags",
1638 FT_UINT8
, BASE_CUSTOM
, CF_FUNC(netlink_route_ifa_flags_label
), 0x00,
1641 { &hf_netlink_route_ifa_scope
,
1642 { "Address scope", "netlink-route.ifa_scope",
1643 FT_UINT8
, BASE_DEC
, NULL
, 0x00,
1646 { &hf_netlink_route_ifa_index
,
1647 { "Interface index", "netlink-route.ifa_index",
1648 FT_INT32
, BASE_DEC
, NULL
, 0x00,
1651 { &hf_netlink_route_ifa_attr_type
,
1652 { "Attribute type", "netlink-route.ifa_attr_type",
1653 FT_UINT16
, BASE_DEC
, VALS(netlink_route_ifa_attr_vals
), 0x00,
1656 { &hf_netlink_route_ifa_label
,
1657 { "Interface name", "netlink-route.ifa_label",
1658 FT_STRINGZ
, BASE_NONE
, NULL
, 0x00,
1661 { &hf_netlink_route_ifa_flags32
,
1662 { "Address flags", "netlink-route.ifa_flags32",
1663 FT_UINT32
, BASE_CUSTOM
, CF_FUNC(netlink_route_ifa_flags_label
), 0x00,
1666 { &hf_netlink_route_ifa_addr6
,
1667 { "Address", "netlink-route.ifa_address.ipv6",
1668 FT_IPv6
, BASE_NONE
, NULL
, 0x00,
1671 { &hf_netlink_route_ifa_addr4
,
1672 { "Address", "netlink-route.ifa_address.ipv4",
1673 FT_IPv4
, BASE_NONE
, NULL
, 0x00,
1676 { &hf_netlink_route_rt_family
,
1677 { "Address family", "netlink-route.rt_family",
1678 FT_UINT8
, BASE_DEC
| BASE_EXT_STRING
, &linux_af_vals_ext
, 0x00,
1681 { &hf_netlink_route_rt_dst_len
,
1682 { "Length of destination", "netlink-route.rt_dst_len",
1683 FT_UINT8
, BASE_DEC
, NULL
, 0x00,
1686 { &hf_netlink_route_rt_src_len
,
1687 { "Length of source", "netlink-route.rt_src_len",
1688 FT_UINT8
, BASE_DEC
, NULL
, 0x00,
1691 { &hf_netlink_route_rt_tos
,
1692 { "TOS filter", "netlink-route.rt_tos",
1693 FT_UINT8
, BASE_HEX
, NULL
, 0x00,
1696 { &hf_netlink_route_rt_table
,
1697 { "Routing table ID", "netlink-route.rt_table",
1698 FT_UINT8
, BASE_DEC
, NULL
, 0x00,
1701 { &hf_netlink_route_rt_protocol
,
1702 { "Routing protocol", "netlink-route.rt_protocol",
1703 FT_UINT8
, BASE_HEX
| BASE_EXT_STRING
, &hf_netlink_route_rt_protocol_vals_ext
, 0x00,
1706 { &hf_netlink_route_rt_scope
,
1707 { "Route origin", "netlink-route.rt_scope",
1708 FT_UINT8
, BASE_HEX
, VALS(netlink_route_rt_scope_vals
), 0x00,
1711 { &hf_netlink_route_rt_type
,
1712 { "Route type", "netlink-route.rt_type",
1713 FT_UINT8
, BASE_HEX
, VALS(netlink_route_rt_type_vals
), 0x00,
1716 { &hf_netlink_route_rt_flags
,
1717 { "Route flags", "netlink-route.rt_flags",
1718 FT_UINT32
, BASE_HEX
, NULL
, 0x00,
1721 { &hf_netlink_route_rta_attr_type
,
1722 { "Attribute type", "netlink-route.rta_attr_type",
1723 FT_UINT16
, BASE_DEC
, VALS(netlink_route_rta_attr_vals
), 0x00,
1726 { &hf_netlink_route_rta_iif
,
1727 { "Input interface index", "netlink-route.rta_iif",
1728 FT_UINT32
, BASE_DEC
, NULL
, 0x00,
1731 { &hf_netlink_route_rta_oif
,
1732 { "Output interface index", "netlink-route.rta_oif",
1733 FT_UINT32
, BASE_DEC
, NULL
, 0x00,
1736 { &hf_netlink_route_nd_family
,
1737 { "Family", "netlink-route.nd_family",
1738 FT_UINT8
, BASE_DEC
| BASE_EXT_STRING
, &linux_af_vals_ext
, 0x00,
1741 { &hf_netlink_route_nd_index
,
1742 { "Interface index", "netlink-route.nd_index",
1743 FT_INT32
, BASE_DEC
, NULL
, 0x00,
1746 { &hf_netlink_route_nd_state
,
1747 { "State", "netlink-route.nd_state",
1748 FT_UINT16
, BASE_CUSTOM
, CF_FUNC(netlink_route_nd_states_label
), 0x00,
1751 { &hf_netlink_route_nd_flags
,
1752 { "Flags", "netlink-route.nd_flags",
1753 FT_UINT8
, BASE_HEX
, NULL
, 0x00,
1756 { &hf_netlink_route_nd_type
,
1757 { "Type", "netlink-route.nd_type",
1758 FT_UINT8
, BASE_HEX
, NULL
, 0x00,
1761 { &hf_netlink_route_nltype
,
1762 { "Message type", "netlink-route.nltype",
1763 FT_UINT16
, BASE_DEC
| BASE_EXT_STRING
, &netlink_route_type_vals_ext
, 0x00,
1768 static int *ett
[] = {
1770 &ett_netlink_route_attr
,
1771 &ett_netlink_route_if_flags
,
1772 &ett_netlink_route_attr_linkstats
,
1773 &ett_netlink_route_attr_linkstats_rxerrs
,
1774 &ett_netlink_route_attr_linkstats_txerrs
,
1777 proto_netlink_route
= proto_register_protocol("Linux rtnetlink (route netlink) protocol", "rtnetlink", "netlink-route" );
1778 proto_register_field_array(proto_netlink_route
, hf
, array_length(hf
));
1779 proto_register_subtree_array(ett
, array_length(ett
));
1781 netlink_route_handle
= register_dissector("netlink-route", dissect_netlink_route
, proto_netlink_route
);
1785 proto_reg_handoff_netlink_route(void)
1787 dissector_add_uint("netlink.protocol", WS_NETLINK_ROUTE
, netlink_route_handle
);
1791 * Editor modelines - https://www.wireshark.org/tools/modelines.html
1796 * indent-tabs-mode: t
1799 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
1800 * :indentSize=8:tabSize=8:noTabs=false: