From: Florian Obser Subject: bgpd: inet_aton To: tech Date: Wed, 21 Aug 2024 09:44:25 +0200 Use inet_pton to parse ext-communities with an IPv4 address. No need for inet_aton's flexibility. regress still passes. OK? diff --git bgpctl/parser.c bgpctl/parser.c index 7654051b8b1..ee46bea7efa 100644 --- bgpctl/parser.c +++ bgpctl/parser.c @@ -1325,7 +1325,7 @@ parseextvalue(int type, char *s, uint32_t *v, uint32_t *flag) *v = uval | (uvalh << 16); break; case EXT_COMMUNITY_TRANS_IPV4: - if (inet_aton(s, &ip) == 0) + if (inet_pton(AF_INET, s, &ip) == 0) errx(1, "Bad ext-community %s not parseable", s); *v = ntohl(ip.s_addr); break; diff --git bgpd/parse.y bgpd/parse.y index 1621c8a1dff..bc9194e9c99 100644 --- bgpd/parse.y +++ bgpd/parse.y @@ -4503,7 +4503,7 @@ parseextvalue(int type, char *s, uint32_t *v, uint32_t *flag) *v = uval | (uvalh << 16); break; case EXT_COMMUNITY_TRANS_IPV4: - if (inet_aton(s, &ip) == 0) { + if (inet_pton(AF_INET, s, &ip) == 0) { yyerror("Bad ext-community %s not parseable", s); return (-1); } -- In my defence, I have been left unsupervised.