mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-05 13:21:22 +00:00
pimd: Start abstraction for WC and RPT bits
Start the abstraction of the WC and RPT bits so we can send the data as appropriate. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
parent
7293a05356
commit
984c84f486
@ -4624,7 +4624,8 @@ static int recv_joinprune(struct vty *vty,
|
||||
remain = buf_pastend - pim_msg_curr;
|
||||
pim_msg_curr = pim_msg_addr_encode_ipv4_source(pim_msg_curr,
|
||||
remain,
|
||||
source_addr);
|
||||
source_addr,
|
||||
PIM_ENCODE_SPARSE_BIT);
|
||||
if (!pim_msg_curr) {
|
||||
vty_out(vty, "Failure encoding source address %s: space left=%d%s",
|
||||
source_str, remain, VTY_NEWLINE);
|
||||
|
@ -431,7 +431,8 @@ int pim_joinprune_send(struct interface *ifp,
|
||||
remain = pastend - pim_msg_curr;
|
||||
pim_msg_curr = pim_msg_addr_encode_ipv4_source(pim_msg_curr,
|
||||
remain,
|
||||
sg->u.sg.src);
|
||||
sg->u.sg.src,
|
||||
PIM_ENCODE_SPARSE_BIT);
|
||||
if (!pim_msg_curr) {
|
||||
char source_str[100];
|
||||
pim_inet4_dump("<src?>", sg->u.sg.src, source_str, sizeof(source_str));
|
||||
|
@ -87,9 +87,9 @@ uint8_t *pim_msg_addr_encode_ipv4_group(uint8_t *buf,
|
||||
return buf + ENCODED_IPV4_GROUP_SIZE;
|
||||
}
|
||||
|
||||
uint8_t *pim_msg_addr_encode_ipv4_source(uint8_t *buf,
|
||||
int buf_size,
|
||||
struct in_addr addr)
|
||||
uint8_t *
|
||||
pim_msg_addr_encode_ipv4_source(uint8_t *buf, int buf_size,
|
||||
struct in_addr addr, uint8_t bits)
|
||||
{
|
||||
const int ENCODED_IPV4_SOURCE_SIZE = 8;
|
||||
|
||||
@ -99,7 +99,7 @@ uint8_t *pim_msg_addr_encode_ipv4_source(uint8_t *buf,
|
||||
|
||||
buf[0] = PIM_MSG_ADDRESS_FAMILY_IPV4; /* addr family */
|
||||
buf[1] = '\0'; /* native encoding */
|
||||
buf[2] = 4; /* reserved = 0 | S bit = 1 | W bit = 0 | R bit = 0 */
|
||||
buf[2] = bits;
|
||||
buf[3] = 32; /* mask len */
|
||||
memcpy(buf+4, &addr, sizeof(struct in_addr));
|
||||
|
||||
|
@ -44,8 +44,13 @@ uint8_t *pim_msg_addr_encode_ipv4_ucast(uint8_t *buf,
|
||||
uint8_t *pim_msg_addr_encode_ipv4_group(uint8_t *buf,
|
||||
int buf_size,
|
||||
struct in_addr addr);
|
||||
|
||||
#define PIM_ENCODE_SPARSE_BIT 0x04
|
||||
#define PIM_ENCODE_WC_BIT 0x02
|
||||
#define PIM_ENCODE_RPT_BIT 0x01
|
||||
uint8_t *pim_msg_addr_encode_ipv4_source(uint8_t *buf,
|
||||
int buf_size,
|
||||
struct in_addr addr);
|
||||
struct in_addr addr,
|
||||
uint8_t bits);
|
||||
|
||||
#endif /* PIM_MSG_H */
|
||||
|
@ -96,6 +96,33 @@ uint8_t *pim_tlv_append_uint32(uint8_t *buf,
|
||||
|
||||
#define ucast_ipv4_encoding_len (2 + sizeof(struct in_addr))
|
||||
|
||||
/*
|
||||
* An Encoded-Unicast address takes the following format:
|
||||
*
|
||||
* 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 | Unicast Address
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+...
|
||||
*
|
||||
* Addr Family
|
||||
* The PIM address family of the 'Unicast Address' field of this
|
||||
* address.
|
||||
*
|
||||
* Values 0-127 are as assigned by the IANA for Internet Address * Families in [7]. Values 128-250 are reserved to be assigned by
|
||||
* the IANA for PIM-specific Address Families. Values 251 though
|
||||
* 255 are designated for private use. As there is no assignment
|
||||
* authority for this space, collisions should be expected.
|
||||
*
|
||||
* Encoding Type
|
||||
* The type of encoding used within a specific Address Family. The
|
||||
* value '0' is reserved for this field and represents the native
|
||||
* encoding of the Address Family.
|
||||
*
|
||||
* Unicast Address
|
||||
* The unicast address as represented by the given Address Family
|
||||
* and Encoding Type.
|
||||
*/
|
||||
int
|
||||
pim_encode_addr_ucast (uint8_t *buf, struct prefix *p)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user