]> git.proxmox.com Git - mirror_frr.git/blob - pimd/pim_igmp_mtrace.h
*: auto-convert to SPDX License IDs
[mirror_frr.git] / pimd / pim_igmp_mtrace.h
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * Multicast traceroute for FRRouting
4 * Copyright (C) 2017 Mladen Sablic
5 */
6
7 #ifndef PIM_IGMP_MTRACE_H
8 #define PIM_IGMP_MTRACE_H
9
10 #include <zebra.h>
11
12 #include "pim_igmp.h"
13
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) */
18
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
35 };
36
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,
49 };
50
51 struct igmp_mtrace_rsp {
52 uint32_t arrival;
53 struct in_addr incoming;
54 struct in_addr outgoing;
55 struct in_addr prev_hop;
56 uint32_t in_count;
57 uint32_t out_count;
58 uint32_t total;
59 uint32_t rtg_proto : 8;
60 uint32_t fwd_ttl : 8;
61 /* little endian order for next three fields */
62 uint32_t src_mask : 6;
63 uint32_t s : 1;
64 uint32_t mbz : 1;
65 uint32_t fwd_code : 8;
66 } __attribute__((packed));
67
68 struct igmp_mtrace {
69 uint8_t type;
70 uint8_t hops;
71 uint16_t checksum;
72 struct in_addr grp_addr;
73 struct in_addr src_addr;
74 struct in_addr dst_addr;
75 struct in_addr rsp_addr;
76 uint32_t rsp_ttl : 8;
77 uint32_t qry_id : 24;
78 struct igmp_mtrace_rsp rsp[0];
79 } __attribute__((packed));
80
81 #define MTRACE_HDR_SIZE (sizeof(struct igmp_mtrace))
82 #define MTRACE_RSP_SIZE (sizeof(struct igmp_mtrace_rsp))
83
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);
87
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);
91
92 #endif /* PIM_IGMP_MTRACE_H */