summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2019-06-21 08:21:03 -0400
committerGitHub <noreply@github.com>2019-06-21 08:21:03 -0400
commiteb7fce2eea3cd0e0360ca7de2ad2bed61ab130b0 (patch)
tree705d1b766692c896b99e309d634ee5ccd0f994db
parent2bc398c3c4af0e3e7c821b81ba97d287246ed2ef (diff)
parent71361a2c3398a01560b4aab114b33915a7a70e81 (diff)
Merge pull request #4576 from sarav511/enc_addr
pimd: Fixing encoded group & source address packing in right byte order
-rw-r--r--pimd/pim_msg.h25
1 files changed, 23 insertions, 2 deletions
diff --git a/pimd/pim_msg.h b/pimd/pim_msg.h
index 5f50303967..b6e2cada1f 100644
--- a/pimd/pim_msg.h
+++ b/pimd/pim_msg.h
@@ -66,9 +66,19 @@ struct pim_encoded_ipv4_unicast {
struct in_addr addr;
} __attribute__((packed));
+/*
+ * Encoded Group format. RFC 4601 Sec 4.9.1
+ * 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
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Addr Family | Encoding Type |B| Reserved |Z| Mask Len |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Group multicast Address
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+...
+ */
struct pim_encoded_group_ipv4 {
- uint8_t ne;
uint8_t family;
+ uint8_t ne;
uint8_t bidir : 1; /* Bidir bit */
uint8_t reserved : 6; /* Reserved */
uint8_t sz : 1; /* scope zone bit */
@@ -76,9 +86,20 @@ struct pim_encoded_group_ipv4 {
struct in_addr addr;
} __attribute__((packed));
+
+/*
+ * Encoded Source format. RFC 4601 Sec 4.9.1
+ * 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
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Addr Family | Encoding Type | Rsrvd |S|W|R| Mask Len |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Source Address
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...
+ */
struct pim_encoded_source_ipv4 {
- uint8_t ne;
uint8_t family;
+ uint8_t ne;
uint8_t bits;
uint8_t mask;
struct in_addr addr;