Mechanically replace inet_aton with inet_pton.
authorflorian <florian@openbsd.org>
Wed, 21 Aug 2024 15:18:00 +0000 (15:18 +0000)
committerflorian <florian@openbsd.org>
Wed, 21 Aug 2024 15:18:00 +0000 (15:18 +0000)
OK claudio, deraadt

usr.sbin/ospfd/database.c
usr.sbin/ospfd/hello.c
usr.sbin/ospfd/interface.c
usr.sbin/ospfd/lsack.c
usr.sbin/ospfd/lsreq.c
usr.sbin/ospfd/lsupdate.c
usr.sbin/ospfd/packet.c

index 5fec976..07005f2 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: database.c,v 1.37 2023/06/20 15:19:55 claudio Exp $ */
+/*     $OpenBSD: database.c,v 1.38 2024/08/21 15:18:00 florian Exp $ */
 
 /*
  * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -116,7 +116,7 @@ send_db_description(struct nbr *nbr)
 
        switch (nbr->iface->type) {
        case IF_TYPE_POINTOPOINT:
-               inet_aton(AllSPFRouters, &dst.sin_addr);
+               inet_pton(AF_INET, AllSPFRouters, &dst.sin_addr);
                dd_hdr.iface_mtu = htons(nbr->iface->mtu);
                break;
        case IF_TYPE_BROADCAST:
index 5b66a92..adbb188 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: hello.c,v 1.26 2022/12/28 21:30:18 jmc Exp $ */
+/*     $OpenBSD: hello.c,v 1.27 2024/08/21 15:18:00 florian Exp $ */
 
 /*
  * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -48,7 +48,7 @@ send_hello(struct iface *iface)
        switch (iface->type) {
        case IF_TYPE_POINTOPOINT:
        case IF_TYPE_BROADCAST:
-               inet_aton(AllSPFRouters, &dst.sin_addr);
+               inet_pton(AF_INET, AllSPFRouters, &dst.sin_addr);
                break;
        case IF_TYPE_NBMA:
        case IF_TYPE_POINTOMULTIPOINT:
index c47268c..96edbae 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: interface.c,v 1.87 2023/03/08 04:43:14 guenther Exp $ */
+/*     $OpenBSD: interface.c,v 1.88 2024/08/21 15:18:00 florian Exp $ */
 
 /*
  * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -352,7 +352,7 @@ if_act_start(struct iface *iface)
 
        switch (iface->type) {
        case IF_TYPE_POINTOPOINT:
-               inet_aton(AllSPFRouters, &addr);
+               inet_pton(AF_INET, AllSPFRouters, &addr);
                if (if_join_group(iface, &addr))
                        return (-1);
                iface->state = IF_STA_POINTTOPOINT;
@@ -366,7 +366,7 @@ if_act_start(struct iface *iface)
                    if_type_name(iface->type), iface->name);
                return (-1);
        case IF_TYPE_BROADCAST:
-               inet_aton(AllSPFRouters, &addr);
+               inet_pton(AF_INET, AllSPFRouters, &addr);
                if (if_join_group(iface, &addr))
                        return (-1);
                if (iface->priority == 0) {
@@ -502,7 +502,7 @@ start:
        iface->bdr = bdr;
 
        if (changed) {
-               inet_aton(AllDRouters, &addr);
+               inet_pton(AF_INET, AllDRouters, &addr);
                if (old_state & IF_STA_DRORBDR &&
                    (iface->state & IF_STA_DRORBDR) == 0) {
                        if (if_leave_group(iface, &addr))
@@ -543,10 +543,10 @@ if_act_reset(struct iface *iface)
        case IF_TYPE_POINTOPOINT:
        case IF_TYPE_BROADCAST:
                /* try to cleanup */
-               inet_aton(AllSPFRouters, &addr);
+               inet_pton(AF_INET, AllSPFRouters, &addr);
                if_leave_group(iface, &addr);
                if (iface->state & IF_STA_DRORBDR) {
-                       inet_aton(AllDRouters, &addr);
+                       inet_pton(AF_INET, AllDRouters, &addr);
                        if_leave_group(iface, &addr);
                }
                break;
index 78cd67a..1255a54 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: lsack.c,v 1.24 2023/03/08 04:43:14 guenther Exp $ */
+/*     $OpenBSD: lsack.c,v 1.25 2024/08/21 15:18:00 florian Exp $ */
 
 /*
  * Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
@@ -268,14 +268,14 @@ ls_ack_tx_timer(int fd, short event, void *arg)
                /* send LS ack(s) but first set correct destination */
                switch (iface->type) {
                case IF_TYPE_POINTOPOINT:
-                       inet_aton(AllSPFRouters, &addr);
+                       inet_pton(AF_INET, AllSPFRouters, &addr);
                        send_ls_ack(iface, addr, buf);
                        break;
                case IF_TYPE_BROADCAST:
                        if (iface->state & IF_STA_DRORBDR)
-                               inet_aton(AllSPFRouters, &addr);
+                               inet_pton(AF_INET, AllSPFRouters, &addr);
                        else
-                               inet_aton(AllDRouters, &addr);
+                               inet_pton(AF_INET, AllDRouters, &addr);
                        send_ls_ack(iface, addr, buf);
                        break;
                case IF_TYPE_NBMA:
index 6b513ba..f8949c3 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: lsreq.c,v 1.24 2023/03/08 04:43:14 guenther Exp $ */
+/*     $OpenBSD: lsreq.c,v 1.25 2024/08/21 15:18:00 florian Exp $ */
 
 /*
  * Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
@@ -45,7 +45,7 @@ send_ls_req(struct nbr *nbr)
 
        switch (nbr->iface->type) {
        case IF_TYPE_POINTOPOINT:
-               inet_aton(AllSPFRouters, &dst.sin_addr);
+               inet_pton(AF_INET, AllSPFRouters, &dst.sin_addr);
                break;
        case IF_TYPE_BROADCAST:
        case IF_TYPE_NBMA:
index 27415ea..7a9872a 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: lsupdate.c,v 1.53 2023/06/21 07:44:08 claudio Exp $ */
+/*     $OpenBSD: lsupdate.c,v 1.54 2024/08/21 15:18:00 florian Exp $ */
 
 /*
  * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -457,7 +457,7 @@ ls_retrans_timer(int fd, short event, void *bula)
                 * because the router switched lately to DR or BDR
                 */
                if (le->le_oneshot && nbr->iface->state & IF_STA_DRORBDR)
-                       inet_aton(AllSPFRouters, &addr);
+                       inet_pton(AF_INET, AllSPFRouters, &addr);
                else if (nbr->iface->state & IF_STA_DRORBDR) {
                        /*
                         * old retransmission needs to be converted into
@@ -471,7 +471,7 @@ ls_retrans_timer(int fd, short event, void *bula)
                } else if (nbr->iface->type == IF_TYPE_POINTOPOINT)
                        memcpy(&addr, &nbr->addr, sizeof(addr));
                else
-                       inet_aton(AllDRouters, &addr);
+                       inet_pton(AF_INET, AllDRouters, &addr);
        } else
                memcpy(&addr, &nbr->addr, sizeof(addr));
 
index 3337271..be8b295 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: packet.c,v 1.37 2023/07/03 09:40:47 claudio Exp $ */
+/*     $OpenBSD: packet.c,v 1.38 2024/08/21 15:18:00 florian Exp $ */
 
 /*
  * Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
@@ -184,9 +184,9 @@ recv_packet(int fd, short event, void *bula)
         * or to the address of the interface itself.
         * AllDRouters is only valid for DR and BDR but this is checked later.
         */
-       inet_aton(AllSPFRouters, &addr);
+       inet_pton(AF_INET, AllSPFRouters, &addr);
        if (ip_hdr.ip_dst.s_addr != addr.s_addr) {
-               inet_aton(AllDRouters, &addr);
+               inet_pton(AF_INET, AllDRouters, &addr);
                if (ip_hdr.ip_dst.s_addr != addr.s_addr) {
                        if (ip_hdr.ip_dst.s_addr != iface->addr.s_addr) {
                                log_debug("recv_packet: packet sent to wrong "
@@ -230,7 +230,7 @@ recv_packet(int fd, short event, void *bula)
        /* switch OSPF packet type */
        switch (ospf_hdr->type) {
        case PACKET_TYPE_HELLO:
-               inet_aton(AllSPFRouters, &addr);
+               inet_pton(AF_INET, AllSPFRouters, &addr);
                if (iface->type == IF_TYPE_BROADCAST ||
                    iface->type == IF_TYPE_POINTOPOINT)
                        if (ip_hdr.ip_dst.s_addr != addr.s_addr) {
@@ -313,8 +313,7 @@ ospf_hdr_sanity_check(const struct ip *ip_hdr, struct ospf_hdr *ospf_hdr,
        }
 
        if (iface->type == IF_TYPE_BROADCAST || iface->type == IF_TYPE_NBMA) {
-               if (inet_aton(AllDRouters, &addr) == 0)
-                       fatalx("recv_packet: inet_aton");
+               inet_pton(AF_INET, AllDRouters, &addr);
                if (ip_hdr->ip_dst.s_addr == addr.s_addr &&
                    (iface->state & IF_STA_DRORBDR) == 0) {
                        log_debug("recv_packet: invalid destination IP in "