diff options
Diffstat (limited to 'ospf6d')
| -rw-r--r-- | ospf6d/ospf6_intra.c | 27 | 
1 files changed, 5 insertions, 22 deletions
diff --git a/ospf6d/ospf6_intra.c b/ospf6d/ospf6_intra.c index 470fc66084..ebecd41ad6 100644 --- a/ospf6d/ospf6_intra.c +++ b/ospf6d/ospf6_intra.c @@ -419,30 +419,13 @@ void ospf6_router_lsa_originate(struct event *thread)  static char *ospf6_network_lsa_get_ar_id(struct ospf6_lsa *lsa, char *buf,  					 int buflen, int pos)  { -	char *start, *end, *current; -	struct ospf6_network_lsa *network_lsa; -	struct ospf6_network_lsdesc *lsdesc; - -	if (lsa) { -		network_lsa = (struct ospf6_network_lsa -				       *)((caddr_t)lsa->header -					  + sizeof(struct ospf6_lsa_header)); - -		start = (char *)network_lsa + sizeof(struct ospf6_network_lsa); -		end = (char *)lsa->header + ntohs(lsa->header->length); -		current = start + pos * (sizeof(struct ospf6_network_lsdesc)); +	struct ospf6_network_lsdesc *lsdesc = nth_lsdesc(lsa->header, pos); -		if ((current + sizeof(struct ospf6_network_lsdesc)) <= end) { -			lsdesc = (struct ospf6_network_lsdesc *)current; -			if (buf) { -				inet_ntop(AF_INET, &lsdesc->router_id, buf, -					  buflen); -				return buf; -			} -		} -	} +	if (!lsdesc || !buf || buflen < (1 + INET_ADDRSTRLEN)) +		return NULL; -	return NULL; +	inet_ntop(AF_INET, &lsdesc->router_id, buf, buflen); +	return buf;  }  static int ospf6_network_lsa_show(struct vty *vty, struct ospf6_lsa *lsa,  | 
