]> git.proxmox.com Git - mirror_frr.git/blame - nhrpd/nhrp_protocol.h
Merge pull request #12798 from donaldsharp/rib_match_multicast
[mirror_frr.git] / nhrpd / nhrp_protocol.h
CommitLineData
47a3a827 1// SPDX-License-Identifier: MIT
2fb975da
TT
2/* nhrp_protocol.h - NHRP protocol definitions
3 *
4 * Copyright (c) 2007-2012 Timo Teräs <timo.teras@iki.fi>
2fb975da
TT
5 */
6
7#ifndef NHRP_PROTOCOL_H
8#define NHRP_PROTOCOL_H
9
10#include <stdint.h>
11
12/* NHRP Ethernet protocol number */
13#define ETH_P_NHRP 0x2001
14
15/* NHRP Version */
16#define NHRP_VERSION_RFC2332 1
17
18/* NHRP Packet Types */
19#define NHRP_PACKET_RESOLUTION_REQUEST 1
20#define NHRP_PACKET_RESOLUTION_REPLY 2
21#define NHRP_PACKET_REGISTRATION_REQUEST 3
22#define NHRP_PACKET_REGISTRATION_REPLY 4
23#define NHRP_PACKET_PURGE_REQUEST 5
24#define NHRP_PACKET_PURGE_REPLY 6
25#define NHRP_PACKET_ERROR_INDICATION 7
26#define NHRP_PACKET_TRAFFIC_INDICATION 8
6c8ca260 27#define NHRP_PACKET_MAX 8
2fb975da
TT
28
29/* NHRP Extension Types */
30#define NHRP_EXTENSION_FLAG_COMPULSORY 0x8000
31#define NHRP_EXTENSION_END 0
32#define NHRP_EXTENSION_PAYLOAD 0
33#define NHRP_EXTENSION_RESPONDER_ADDRESS 3
34#define NHRP_EXTENSION_FORWARD_TRANSIT_NHS 4
35#define NHRP_EXTENSION_REVERSE_TRANSIT_NHS 5
36#define NHRP_EXTENSION_AUTHENTICATION 7
37#define NHRP_EXTENSION_VENDOR 8
38#define NHRP_EXTENSION_NAT_ADDRESS 9
39
40/* NHRP Error Indication Codes */
41#define NHRP_ERROR_UNRECOGNIZED_EXTENSION 1
42#define NHRP_ERROR_LOOP_DETECTED 2
43#define NHRP_ERROR_PROTOCOL_ADDRESS_UNREACHABLE 6
44#define NHRP_ERROR_PROTOCOL_ERROR 7
45#define NHRP_ERROR_SDU_SIZE_EXCEEDED 8
46#define NHRP_ERROR_INVALID_EXTENSION 9
47#define NHRP_ERROR_INVALID_RESOLUTION_REPLY 10
48#define NHRP_ERROR_AUTHENTICATION_FAILURE 11
49#define NHRP_ERROR_HOP_COUNT_EXCEEDED 15
50
51/* NHRP CIE Codes */
52#define NHRP_CODE_SUCCESS 0
53#define NHRP_CODE_ADMINISTRATIVELY_PROHIBITED 4
54#define NHRP_CODE_INSUFFICIENT_RESOURCES 5
55#define NHRP_CODE_NO_BINDING_EXISTS 11
56#define NHRP_CODE_BINDING_NON_UNIQUE 13
57#define NHRP_CODE_UNIQUE_ADDRESS_REGISTERED 14
58
59/* NHRP Flags for Resolution request/reply */
60#define NHRP_FLAG_RESOLUTION_SOURCE_IS_ROUTER 0x8000
61#define NHRP_FLAG_RESOLUTION_AUTHORATIVE 0x4000
62#define NHRP_FLAG_RESOLUTION_DESTINATION_STABLE 0x2000
63#define NHRP_FLAG_RESOLUTION_UNIQUE 0x1000
64#define NHRP_FLAG_RESOLUTION_SOURCE_STABLE 0x0800
65#define NHRP_FLAG_RESOLUTION_NAT 0x0002
66
67/* NHRP Flags for Registration request/reply */
68#define NHRP_FLAG_REGISTRATION_UNIQUE 0x8000
69#define NHRP_FLAG_REGISTRATION_NAT 0x0002
70
71/* NHRP Flags for Purge request/reply */
72#define NHRP_FLAG_PURGE_NO_REPLY 0x8000
73
74/* NHRP Authentication extension types (ala Cisco) */
75#define NHRP_AUTHENTICATION_PLAINTEXT 0x00000001
76
77/* NHRP Packet Structures */
78struct nhrp_packet_header {
79 /* Fixed header */
996c9314
LB
80 uint16_t afnum;
81 uint16_t protocol_type;
82 uint8_t snap[5];
83 uint8_t hop_count;
84 uint16_t packet_size;
85 uint16_t checksum;
86 uint16_t extension_offset;
87 uint8_t version;
88 uint8_t type;
89 uint8_t src_nbma_address_len;
90 uint8_t src_nbma_subaddress_len;
2fb975da
TT
91
92 /* Mandatory header */
996c9314
LB
93 uint8_t src_protocol_address_len;
94 uint8_t dst_protocol_address_len;
95 uint16_t flags;
2fb975da 96 union {
996c9314 97 uint32_t request_id;
2fb975da 98 struct {
996c9314
LB
99 uint16_t code;
100 uint16_t offset;
2fb975da
TT
101 } error;
102 } u;
103} __attribute__((packed));
104
105struct nhrp_cie_header {
996c9314
LB
106 uint8_t code;
107 uint8_t prefix_length;
108 uint16_t unused;
109 uint16_t mtu;
110 uint16_t holding_time;
111 uint8_t nbma_address_len;
112 uint8_t nbma_subaddress_len;
113 uint8_t protocol_address_len;
114 uint8_t preference;
2fb975da
TT
115} __attribute__((packed));
116
117struct nhrp_extension_header {
996c9314
LB
118 uint16_t type;
119 uint16_t length;
2fb975da
TT
120} __attribute__((packed));
121
122struct nhrp_cisco_authentication_extension {
996c9314
LB
123 uint32_t type;
124 uint8_t secret[8];
2fb975da
TT
125} __attribute__((packed));
126
127#endif