1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Multicast traceroute for FRRouting
4 * Copyright (C) 2017 Mladen Sablic
7 #ifndef PIM_IGMP_MTRACE_H
8 #define PIM_IGMP_MTRACE_H
14 #define MTRACE_MAX_HOPS (255)
15 #define MTRACE_UNKNOWN_COUNT (0xffffffff)
16 #define MTRACE_SRC_MASK_GROUP (0x3f) /* forwarding on group state (*,G) */
17 #define MTRACE_SRC_MASK_SOURCE (0x20) /* i.e. 32 forwarding on (S,G) */
19 enum mtrace_fwd_code
{
20 MTRACE_FWD_CODE_NO_ERROR
= 0x00,
21 MTRACE_FWD_CODE_WRONG_IF
= 0x01,
22 MTRACE_FWD_CODE_PRUNE_SENT
= 0x02,
23 MTRACE_FWD_CODE_PRUNE_RCVD
= 0x03,
24 MTRACE_FWD_CODE_SCOPED
= 0x04,
25 MTRACE_FWD_CODE_NO_ROUTE
= 0x05,
26 MTRACE_FWD_CODE_WRONG_LAST_HOP
= 0x06,
27 MTRACE_FWD_CODE_NOT_FORWARDING
= 0x07,
28 MTRACE_FWD_CODE_REACHED_RP
= 0x08,
29 MTRACE_FWD_CODE_RPF_IF
= 0x09,
30 MTRACE_FWD_CODE_NO_MULTICAST
= 0x0A,
31 MTRACE_FWD_CODE_INFO_HIDDEN
= 0x0B,
32 MTRACE_FWD_CODE_NO_SPACE
= 0x81,
33 MTRACE_FWD_CODE_OLD_ROUTER
= 0x82,
34 MTRACE_FWD_CODE_ADMIN_PROHIB
= 0x83
37 enum mtrace_rtg_proto
{
38 MTRACE_RTG_PROTO_DVMRP
= 1,
39 MTRACE_RTG_PROTO_MOSPF
= 2,
40 MTRACE_RTG_PROTO_PIM
= 3,
41 MTRACE_RTG_PROTO_CBT
= 4,
42 MTRACE_RTG_PROTO_PIM_SPECIAL
= 5,
43 MTRACE_RTG_PROTO_PIM_STATIC
= 6,
44 MTRACE_RTG_PROTO_DVMRP_STATIC
= 7,
45 MTRACE_RTG_PROTO_PIM_MBGP
= 8,
46 MTRACE_RTG_PROTO_CBT_SPECIAL
= 9,
47 MTRACE_RTG_PROTO_CBT_STATIC
= 10,
48 MTRACE_RTG_PROTO_PIM_ASSERT
= 11,
51 struct igmp_mtrace_rsp
{
53 struct in_addr incoming
;
54 struct in_addr outgoing
;
55 struct in_addr prev_hop
;
59 uint32_t rtg_proto
: 8;
61 /* little endian order for next three fields */
62 uint32_t src_mask
: 6;
65 uint32_t fwd_code
: 8;
66 } __attribute__((packed
));
72 struct in_addr grp_addr
;
73 struct in_addr src_addr
;
74 struct in_addr dst_addr
;
75 struct in_addr rsp_addr
;
78 struct igmp_mtrace_rsp rsp
[0];
79 } __attribute__((packed
));
81 #define MTRACE_HDR_SIZE (sizeof(struct igmp_mtrace))
82 #define MTRACE_RSP_SIZE (sizeof(struct igmp_mtrace_rsp))
84 int igmp_mtrace_recv_qry_req(struct gm_sock
*igmp
, struct ip
*ip_hdr
,
85 struct in_addr from
, const char *from_str
,
86 char *igmp_msg
, int igmp_msg_len
);
88 int igmp_mtrace_recv_response(struct gm_sock
*igmp
, struct ip
*ip_hdr
,
89 struct in_addr from
, const char *from_str
,
90 char *igmp_msg
, int igmp_msg_len
);
92 #endif /* PIM_IGMP_MTRACE_H */