2 * Multicast traceroute for FRRouting
3 * Copyright (C) 2017 Mladen Sablic
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; see the file COPYING; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 #ifndef PIM_IGMP_MTRACE_H
21 #define PIM_IGMP_MTRACE_H
27 #define MTRACE_MAX_HOPS (255)
28 #define MTRACE_UNKNOWN_COUNT (0xffffffff)
29 #define MTRACE_SRC_MASK_GROUP (0x3f) /* forwarding on group state (*,G) */
30 #define MTRACE_SRC_MASK_SOURCE (0x20) /* i.e. 32 forwarding on (S,G) */
32 enum mtrace_fwd_code
{
33 MTRACE_FWD_CODE_NO_ERROR
= 0x00,
34 MTRACE_FWD_CODE_WRONG_IF
= 0x01,
35 MTRACE_FWD_CODE_PRUNE_SENT
= 0x02,
36 MTRACE_FWD_CODE_PRUNE_RCVD
= 0x03,
37 MTRACE_FWD_CODE_SCOPED
= 0x04,
38 MTRACE_FWD_CODE_NO_ROUTE
= 0x05,
39 MTRACE_FWD_CODE_WRONG_LAST_HOP
= 0x06,
40 MTRACE_FWD_CODE_NOT_FORWARDING
= 0x07,
41 MTRACE_FWD_CODE_REACHED_RP
= 0x08,
42 MTRACE_FWD_CODE_RPF_IF
= 0x09,
43 MTRACE_FWD_CODE_NO_MULTICAST
= 0x0A,
44 MTRACE_FWD_CODE_INFO_HIDDEN
= 0x0B,
45 MTRACE_FWD_CODE_NO_SPACE
= 0x81,
46 MTRACE_FWD_CODE_OLD_ROUTER
= 0x82,
47 MTRACE_FWD_CODE_ADMIN_PROHIB
= 0x83
50 enum mtrace_rtg_proto
{
51 MTRACE_RTG_PROTO_DVMRP
= 1,
52 MTRACE_RTG_PROTO_MOSPF
= 2,
53 MTRACE_RTG_PROTO_PIM
= 3,
54 MTRACE_RTG_PROTO_CBT
= 4,
55 MTRACE_RTG_PROTO_PIM_SPECIAL
= 5,
56 MTRACE_RTG_PROTO_PIM_STATIC
= 6,
57 MTRACE_RTG_PROTO_DVMRP_STATIC
= 7,
58 MTRACE_RTG_PROTO_PIM_MBGP
= 8,
59 MTRACE_RTG_PROTO_CBT_SPECIAL
= 9,
60 MTRACE_RTG_PROTO_CBT_STATIC
= 10,
61 MTRACE_RTG_PROTO_PIM_ASSERT
= 11,
64 struct igmp_mtrace_rsp
{
66 struct in_addr incoming
;
67 struct in_addr outgoing
;
68 struct in_addr prev_hop
;
72 uint32_t rtg_proto
: 8;
74 /* little endian order for next three fields */
75 uint32_t src_mask
: 6;
78 uint32_t fwd_code
: 8;
79 } __attribute__((packed
));
85 struct in_addr grp_addr
;
86 struct in_addr src_addr
;
87 struct in_addr dst_addr
;
88 struct in_addr rsp_addr
;
91 struct igmp_mtrace_rsp rsp
[0];
92 } __attribute__((packed
));
94 #define MTRACE_HDR_SIZE (sizeof(struct igmp_mtrace))
95 #define MTRACE_RSP_SIZE (sizeof(struct igmp_mtrace_rsp))
97 int igmp_mtrace_recv_qry_req(struct igmp_sock
*igmp
, struct ip
*ip_hdr
,
98 struct in_addr from
, const char *from_str
,
99 char *igmp_msg
, int igmp_msg_len
);
101 int igmp_mtrace_recv_response(struct igmp_sock
*igmp
, struct ip
*ip_hdr
,
102 struct in_addr from
, const char *from_str
,
103 char *igmp_msg
, int igmp_msg_len
);
105 #endif /* PIM_IGMP_MTRACE_H */