forked from Mirror/frr
pim6d: add pimv6 support for bsm_hdr
Signed-off-by: sarita patra <saritap@vmware.com>
This commit is contained in:
parent
11e1593f9f
commit
1ae87bdd38
|
@ -1281,7 +1281,6 @@ int pim_bsm_process(struct interface *ifp, pim_sgaddr *sg, uint8_t *buf,
|
|||
struct pim_interface *pim_ifp = NULL;
|
||||
struct bsm_frag *bsfrag;
|
||||
struct pim_instance *pim;
|
||||
char bsr_str[INET_ADDRSTRLEN];
|
||||
uint16_t frag_tag;
|
||||
bool empty_bsm = false;
|
||||
|
||||
|
@ -1324,11 +1323,10 @@ int pim_bsm_process(struct interface *ifp, pim_sgaddr *sg, uint8_t *buf,
|
|||
}
|
||||
|
||||
bshdr = (struct bsm_hdr *)(buf + PIM_MSG_HEADER_LEN);
|
||||
pim_inet4_dump("<bsr?>", bshdr->bsr_addr.addr, bsr_str,
|
||||
sizeof(bsr_str));
|
||||
if (bshdr->hm_len > IPV4_MAX_BITLEN) {
|
||||
zlog_warn("Bad hashmask length for IPv4; got %hhu, expected value in range 0-32",
|
||||
bshdr->hm_len);
|
||||
if (bshdr->hm_len > PIM_MAX_BITLEN) {
|
||||
zlog_warn(
|
||||
"Bad hashmask length for %s; got %hhu, expected value in range 0-32",
|
||||
PIM_AF_NAME, bshdr->hm_len);
|
||||
pim->bsm_dropped++;
|
||||
return -1;
|
||||
}
|
||||
|
@ -1371,8 +1369,9 @@ int pim_bsm_process(struct interface *ifp, pim_sgaddr *sg, uint8_t *buf,
|
|||
} else {
|
||||
if (PIM_DEBUG_BSM)
|
||||
zlog_debug(
|
||||
"%s : nofwd_bsm received on %s when accpt_nofwd_bsm false",
|
||||
__func__, bsr_str);
|
||||
"%s : nofwd_bsm received on %pPAs when accpt_nofwd_bsm false",
|
||||
__func__,
|
||||
(pim_addr *)&bshdr->bsr_addr.addr);
|
||||
pim->bsm_dropped++;
|
||||
pim_ifp->pim_ifstat_ucast_bsm_cfg_miss++;
|
||||
return -1;
|
||||
|
@ -1385,7 +1384,6 @@ int pim_bsm_process(struct interface *ifp, pim_sgaddr *sg, uint8_t *buf,
|
|||
if (0)
|
||||
#endif
|
||||
{
|
||||
#if PIM_IPV == 4
|
||||
/* Multicast BSMs are only accepted if source interface & IP
|
||||
* match RPF towards the BSR's IP address, or they have
|
||||
* no-forward set
|
||||
|
@ -1394,8 +1392,9 @@ int pim_bsm_process(struct interface *ifp, pim_sgaddr *sg, uint8_t *buf,
|
|||
ifp, sg->src)) {
|
||||
if (PIM_DEBUG_BSM)
|
||||
zlog_debug(
|
||||
"BSM check: RPF to BSR %s is not %pPA%%%s",
|
||||
bsr_str, &sg->src, ifp->name);
|
||||
"BSM check: RPF to BSR %pPAs is not %pPA%%%s",
|
||||
(pim_addr *)&bshdr->bsr_addr.addr,
|
||||
&sg->src, ifp->name);
|
||||
pim->bsm_dropped++;
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -185,7 +185,11 @@ struct bsm_hdr {
|
|||
uint16_t frag_tag;
|
||||
uint8_t hm_len;
|
||||
uint8_t bsr_prio;
|
||||
#if PIM_IPV == 4
|
||||
struct pim_encoded_ipv4_unicast bsr_addr;
|
||||
#else
|
||||
struct pim_encoded_ipv6_unicast bsr_addr;
|
||||
#endif
|
||||
} __attribute__((packed));
|
||||
|
||||
struct bsmmsg_grpinfo {
|
||||
|
|
|
@ -861,7 +861,6 @@ static void pim_show_bsm_db(struct pim_instance *pim, struct vty *vty, bool uj)
|
|||
frr_each (bsm_frags, pim->global_scope.bsm_frags, bsfrag) {
|
||||
char grp_str[PREFIX_STRLEN];
|
||||
char rp_str[INET_ADDRSTRLEN];
|
||||
char bsr_str[INET_ADDRSTRLEN];
|
||||
struct bsmmsg_grpinfo *group;
|
||||
struct bsmmsg_rpinfo *rpaddr;
|
||||
struct prefix grp;
|
||||
|
@ -884,11 +883,9 @@ static void pim_show_bsm_db(struct pim_instance *pim, struct vty *vty, bool uj)
|
|||
buf += sizeof(struct bsm_hdr);
|
||||
len -= sizeof(struct bsm_hdr);
|
||||
|
||||
snprintfrr(bsr_str, sizeof(bsr_str), "%pPAs",
|
||||
&hdr->bsr_addr.addr);
|
||||
|
||||
if (uj) {
|
||||
json_object_string_add(json, "BSR address", bsr_str);
|
||||
json_object_string_addf(json, "BSR address", "%pPA",
|
||||
&hdr->bsr_addr.addr);
|
||||
json_object_int_add(json, "BSR priority",
|
||||
hdr->bsr_prio);
|
||||
json_object_int_add(json, "Hashmask Length",
|
||||
|
@ -900,7 +897,8 @@ static void pim_show_bsm_db(struct pim_instance *pim, struct vty *vty, bool uj)
|
|||
vty_out(vty, "------------------\n");
|
||||
vty_out(vty, "%-15s %-15s %-15s %-15s\n", "BSR-Address",
|
||||
"BSR-Priority", "Hashmask-len", "Fragment-Tag");
|
||||
vty_out(vty, "%-15s %-15d %-15d %-15d\n", bsr_str,
|
||||
vty_out(vty, "%-15pPA %-15d %-15d %-15d\n",
|
||||
&hdr->bsr_addr.addr,
|
||||
hdr->bsr_prio, hdr->hm_len,
|
||||
ntohs(hdr->frag_tag));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue