From: Claudio Jeker Subject: Re: bgpd: inet_aton To: tech Date: Wed, 21 Aug 2024 10:23:54 +0200 On Wed, Aug 21, 2024 at 09:44:25AM +0200, Florian Obser wrote: > 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); > } > OK claudio@ -- :wq Claudio