summaryrefslogtreecommitdiff
path: root/pimd/pim_msg.h
diff options
context:
space:
mode:
authorsaravanank <saravanank@vmware.com>2019-05-04 05:07:39 -0700
committersaravanank <saravanank@vmware.com>2019-05-14 21:40:50 -0700
commitd57a8bbf4591ae00dcaa0f9dac29cc936cce505d (patch)
tree6baeb96f2f4ea3e325a5d6dd107fb96fa7fe66c7 /pimd/pim_msg.h
parentc843f56de2987381bfa38fe343c5f6a5ec23d2cd (diff)
pimd: PIM Msg header includes N bit as defined by RFC
This commit includes parsing of Nbit and contructing pim hdr with Nbit Adding Nbit to PIm hdr structure Adding Scope zone bit and Bidir bit to Encoded IPv4 Group Address Signed-off-by: Saravanan K <saravanank@vmware.com>
Diffstat (limited to 'pimd/pim_msg.h')
-rw-r--r--pimd/pim_msg.h19
1 files changed, 16 insertions, 3 deletions
diff --git a/pimd/pim_msg.h b/pimd/pim_msg.h
index ad9b5d9c01..5f50303967 100644
--- a/pimd/pim_msg.h
+++ b/pimd/pim_msg.h
@@ -23,6 +23,8 @@
#include <netinet/in.h>
#include "pim_jp_agg.h"
+
+#define PIM_HDR_LEN sizeof(struct pim_msg_header)
/*
Number Description
---------- ------------------
@@ -41,11 +43,20 @@ enum pim_msg_address_family {
/*
* Network Order pim_msg_hdr
+ * =========================
+ * PIM Header definition as per RFC 5059. N bit introduced to indicate
+ * do-not-forward option in PIM Boot strap Message.
+ * 0 1 2 3
+ * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * |PIM Ver| Type |N| Reserved | Checksum |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
struct pim_msg_header {
uint8_t type : 4;
uint8_t ver : 4;
- uint8_t reserved;
+ uint8_t Nbit : 1; /* No Fwd Bit */
+ uint8_t reserved : 7;
uint16_t checksum;
} __attribute__((packed));
@@ -58,7 +69,9 @@ struct pim_encoded_ipv4_unicast {
struct pim_encoded_group_ipv4 {
uint8_t ne;
uint8_t family;
- uint8_t reserved;
+ uint8_t bidir : 1; /* Bidir bit */
+ uint8_t reserved : 6; /* Reserved */
+ uint8_t sz : 1; /* scope zone bit */
uint8_t mask;
struct in_addr addr;
} __attribute__((packed));
@@ -88,7 +101,7 @@ struct pim_jp {
} __attribute__((packed));
void pim_msg_build_header(uint8_t *pim_msg, size_t pim_msg_size,
- uint8_t pim_msg_type);
+ uint8_t pim_msg_type, bool no_fwd);
uint8_t *pim_msg_addr_encode_ipv4_ucast(uint8_t *buf, struct in_addr addr);
uint8_t *pim_msg_addr_encode_ipv4_group(uint8_t *buf, struct in_addr addr);