]>
Commit | Line | Data |
---|---|---|
4d9ad5dc MS |
1 | /* |
2 | * Multicast traceroute for FRRouting | |
3 | * Copyright (C) 2017 Mladen Sablic | |
4 | * | |
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. | |
9 | * | |
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. | |
14 | * | |
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 | |
18 | */ | |
19 | ||
20 | #ifndef PIM_IGMP_MTRACE_H | |
21 | #define PIM_IGMP_MTRACE_H | |
22 | ||
23 | #include <zebra.h> | |
24 | ||
25 | #include "pim_igmp.h" | |
26 | ||
27 | #define MTRACE_MAX_HOPS (255) | |
28 | #define MTRACE_UNKNOWN_COUNT (0xffffffff) | |
71e55fb2 MS |
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) */ | |
4d9ad5dc MS |
31 | |
32 | enum mtrace_fwd_code { | |
996c9314 LB |
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 | |
4d9ad5dc MS |
48 | }; |
49 | ||
50 | enum mtrace_rtg_proto { | |
996c9314 LB |
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, | |
4d9ad5dc MS |
62 | }; |
63 | ||
64 | struct igmp_mtrace_rsp { | |
65 | uint32_t arrival; | |
66 | struct in_addr incoming; | |
67 | struct in_addr outgoing; | |
68 | struct in_addr prev_hop; | |
69 | uint32_t in_count; | |
70 | uint32_t out_count; | |
71 | uint32_t total; | |
72 | uint32_t rtg_proto : 8; | |
73 | uint32_t fwd_ttl : 8; | |
74 | /* little endian order for next three fields */ | |
75 | uint32_t src_mask : 6; | |
76 | uint32_t s : 1; | |
77 | uint32_t mbz : 1; | |
78 | uint32_t fwd_code : 8; | |
79 | } __attribute__((packed)); | |
80 | ||
81 | struct igmp_mtrace { | |
82 | uint8_t type; | |
83 | uint8_t hops; | |
84 | uint16_t checksum; | |
85 | struct in_addr grp_addr; | |
86 | struct in_addr src_addr; | |
87 | struct in_addr dst_addr; | |
88 | struct in_addr rsp_addr; | |
89 | uint32_t rsp_ttl : 8; | |
90 | uint32_t qry_id : 24; | |
91 | struct igmp_mtrace_rsp rsp[0]; | |
92 | } __attribute__((packed)); | |
93 | ||
94 | #define MTRACE_HDR_SIZE (sizeof(struct igmp_mtrace)) | |
95 | #define MTRACE_RSP_SIZE (sizeof(struct igmp_mtrace_rsp)) | |
96 | ||
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); | |
100 | ||
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); | |
104 | ||
105 | #endif /* PIM_IGMP_MTRACE_H */ |