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)
30 enum mtrace_fwd_code
{
31 MTRACE_FWD_CODE_NO_ERROR
= 0x00,
32 MTRACE_FWD_CODE_WRONG_IF
= 0x01,
33 MTRACE_FWD_CODE_PRUNE_SENT
= 0x02,
34 MTRACE_FWD_CODE_PRUNE_RCVD
= 0x03,
35 MTRACE_FWD_CODE_SCOPED
= 0x04,
36 MTRACE_FWD_CODE_NO_ROUTE
= 0x05,
37 MTRACE_FWD_CODE_WRONG_LAST_HOP
= 0x06,
38 MTRACE_FWD_CODE_NOT_FORWARDING
= 0x07,
39 MTRACE_FWD_CODE_REACHED_RP
= 0x08,
40 MTRACE_FWD_CODE_RPF_IF
= 0x09,
41 MTRACE_FWD_CODE_NO_MULTICAST
= 0x0A,
42 MTRACE_FWD_CODE_INFO_HIDDEN
= 0x0B,
43 MTRACE_FWD_CODE_NO_SPACE
= 0x81,
44 MTRACE_FWD_CODE_OLD_ROUTER
= 0x82,
45 MTRACE_FWD_CODE_ADMIN_PROHIB
= 0x83
48 enum mtrace_rtg_proto
{
49 MTRACE_RTG_PROTO_DVMRP
= 1,
50 MTRACE_RTG_PROTO_MOSPF
= 2,
51 MTRACE_RTG_PROTO_PIM
= 3,
52 MTRACE_RTG_PROTO_CBT
= 4,
53 MTRACE_RTG_PROTO_PIM_SPECIAL
= 5,
54 MTRACE_RTG_PROTO_PIM_STATIC
= 6,
55 MTRACE_RTG_PROTO_DVMRP_STATIC
= 7,
56 MTRACE_RTG_PROTO_PIM_MBGP
= 8,
57 MTRACE_RTG_PROTO_CBT_SPECIAL
= 9,
58 MTRACE_RTG_PROTO_CBT_STATIC
= 10,
59 MTRACE_RTG_PROTO_PIM_ASSERT
= 11,
62 struct igmp_mtrace_rsp
{
64 struct in_addr incoming
;
65 struct in_addr outgoing
;
66 struct in_addr prev_hop
;
70 uint32_t rtg_proto
: 8;
72 /* little endian order for next three fields */
73 uint32_t src_mask
: 6;
76 uint32_t fwd_code
: 8;
77 } __attribute__((packed
));
83 struct in_addr grp_addr
;
84 struct in_addr src_addr
;
85 struct in_addr dst_addr
;
86 struct in_addr rsp_addr
;
89 struct igmp_mtrace_rsp rsp
[0];
90 } __attribute__((packed
));
92 #define MTRACE_HDR_SIZE (sizeof(struct igmp_mtrace))
93 #define MTRACE_RSP_SIZE (sizeof(struct igmp_mtrace_rsp))
95 int igmp_mtrace_recv_qry_req(struct igmp_sock
*igmp
, struct ip
*ip_hdr
,
96 struct in_addr from
, const char *from_str
,
97 char *igmp_msg
, int igmp_msg_len
);
99 int igmp_mtrace_recv_response(struct igmp_sock
*igmp
, struct ip
*ip_hdr
,
100 struct in_addr from
, const char *from_str
,
101 char *igmp_msg
, int igmp_msg_len
);
103 #endif /* PIM_IGMP_MTRACE_H */