diff options
| author | David Lamparter <equinox@opensourcerouting.org> | 2022-01-14 16:38:41 +0100 | 
|---|---|---|
| committer | David Lamparter <equinox@opensourcerouting.org> | 2022-02-14 06:45:03 +0100 | 
| commit | 0d360092045fdfca1a363bbc522deafbb79255e8 (patch) | |
| tree | 9ce974e3fb9af2dfb2b6ea5e35c92328dbd115a0 /pimd/pim_register.c | |
| parent | 16763d77a39ae0cd84e6fcf4b3f6a05f10d94c38 (diff) | |
pim6d: more TLV parse/encode IPv6 preparation
More proliferation of pim_addr to work towards IPV6.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'pimd/pim_register.c')
| -rw-r--r-- | pimd/pim_register.c | 16 | 
1 files changed, 8 insertions, 8 deletions
diff --git a/pimd/pim_register.c b/pimd/pim_register.c index 855d912566..a0def299fa 100644 --- a/pimd/pim_register.c +++ b/pimd/pim_register.c @@ -72,7 +72,6 @@ void pim_register_stop_send(struct interface *ifp, pim_sgaddr *sg,  	unsigned int b1length = 0;  	unsigned int length;  	uint8_t *b1; -	struct prefix p;  	if (PIM_DEBUG_PIM_REG) {  		zlog_debug("Sending Register stop for %pSG to %pI4 on %s", sg, @@ -86,10 +85,7 @@ void pim_register_stop_send(struct interface *ifp, pim_sgaddr *sg,  	b1length += length;  	b1 += length; -	p.family = AF_INET; -	p.u.prefix4 = sg->src; -	p.prefixlen = IPV4_MAX_BITLEN; -	length = pim_encode_addr_ucast(b1, &p); +	length = pim_encode_addr_ucast(b1, sg->src);  	b1length += length;  	pim_msg_build_header(buffer, b1length + PIM_MSG_REGISTER_STOP_LEN, @@ -117,8 +113,8 @@ int pim_register_stop_recv(struct interface *ifp, uint8_t *buf, int buf_size)  	struct pim_interface *pim_ifp = ifp->info;  	struct pim_instance *pim = pim_ifp->pim;  	struct pim_upstream *upstream = NULL; -	struct prefix source;  	pim_sgaddr sg; +	bool wrong_af = false;  	int l;  	++pim_ifp->pim_ifstat_reg_stop_recv; @@ -127,8 +123,12 @@ int pim_register_stop_recv(struct interface *ifp, uint8_t *buf, int buf_size)  	l = pim_parse_addr_group(&sg, buf, buf_size);  	buf += l;  	buf_size -= l; -	pim_parse_addr_ucast(&source, buf, buf_size); -	sg.src = source.u.prefix4; +	pim_parse_addr_ucast(&sg.src, buf, buf_size, &wrong_af); + +	if (wrong_af) { +		zlog_err("invalid AF in Register-Stop on %s", ifp->name); +		return 0; +	}  	upstream = pim_upstream_find(pim, &sg);  	if (!upstream) {  | 
