]> git.proxmox.com Git - mirror_frr.git/blame - pimd/pim_igmp_mtrace.h
bgpd: another change to keep indent.py happy
[mirror_frr.git] / pimd / pim_igmp_mtrace.h
CommitLineData
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)
29
30enum 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
46};
47
48enum 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,
60};
61
62struct igmp_mtrace_rsp {
63 uint32_t arrival;
64 struct in_addr incoming;
65 struct in_addr outgoing;
66 struct in_addr prev_hop;
67 uint32_t in_count;
68 uint32_t out_count;
69 uint32_t total;
70 uint32_t rtg_proto : 8;
71 uint32_t fwd_ttl : 8;
72 /* little endian order for next three fields */
73 uint32_t src_mask : 6;
74 uint32_t s : 1;
75 uint32_t mbz : 1;
76 uint32_t fwd_code : 8;
77} __attribute__((packed));
78
79struct igmp_mtrace {
80 uint8_t type;
81 uint8_t hops;
82 uint16_t checksum;
83 struct in_addr grp_addr;
84 struct in_addr src_addr;
85 struct in_addr dst_addr;
86 struct in_addr rsp_addr;
87 uint32_t rsp_ttl : 8;
88 uint32_t qry_id : 24;
89 struct igmp_mtrace_rsp rsp[0];
90} __attribute__((packed));
91
92#define MTRACE_HDR_SIZE (sizeof(struct igmp_mtrace))
93#define MTRACE_RSP_SIZE (sizeof(struct igmp_mtrace_rsp))
94
95int 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);
98
99int 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);
102
103#endif /* PIM_IGMP_MTRACE_H */