summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/ospf6d/parse.y5
-rw-r--r--usr.sbin/ospfd/parse.y5
-rw-r--r--usr.sbin/pppd/sys-bsd.c11
3 files changed, 14 insertions, 7 deletions
diff --git a/usr.sbin/ospf6d/parse.y b/usr.sbin/ospf6d/parse.y
index f163e24149d..d49df81a81e 100644
--- a/usr.sbin/ospf6d/parse.y
+++ b/usr.sbin/ospf6d/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.49 2020/01/21 20:38:52 remi Exp $ */
+/* $OpenBSD: parse.y,v 1.50 2020/12/29 19:44:26 benno Exp $ */
/*
* Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
@@ -1253,7 +1253,8 @@ get_rtr_id(void)
for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
if (strncmp(ifa->ifa_name, "carp", 4) == 0)
continue;
- if (ifa->ifa_addr->sa_family != AF_INET)
+ if (ifa->ifa_addr == NULL ||
+ ifa->ifa_addr->sa_family != AF_INET)
continue;
cur = ((struct sockaddr_in *)ifa->ifa_addr)->sin_addr.s_addr;
if ((cur & localnet) == localnet) /* skip 127/8 */
diff --git a/usr.sbin/ospfd/parse.y b/usr.sbin/ospfd/parse.y
index a09696504f8..3e05873211a 100644
--- a/usr.sbin/ospfd/parse.y
+++ b/usr.sbin/ospfd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.100 2020/01/21 20:38:52 remi Exp $ */
+/* $OpenBSD: parse.y,v 1.101 2020/12/29 19:44:47 benno Exp $ */
/*
* Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
@@ -1469,7 +1469,8 @@ get_rtr_id(void)
for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
if (strncmp(ifa->ifa_name, "carp", 4) == 0)
continue;
- if (ifa->ifa_addr->sa_family != AF_INET)
+ if (ifa->ifa_addr == NULL ||
+ ifa->ifa_addr->sa_family != AF_INET)
continue;
cur = ((struct sockaddr_in *)ifa->ifa_addr)->sin_addr.s_addr;
if ((cur & localnet) == localnet) /* skip 127/8 */
diff --git a/usr.sbin/pppd/sys-bsd.c b/usr.sbin/pppd/sys-bsd.c
index e8deee6d2ff..4668c3ce6e4 100644
--- a/usr.sbin/pppd/sys-bsd.c
+++ b/usr.sbin/pppd/sys-bsd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sys-bsd.c,v 1.29 2019/06/28 13:32:49 deraadt Exp $ */
+/* $OpenBSD: sys-bsd.c,v 1.30 2020/12/29 19:45:28 benno Exp $ */
/*
* sys-bsd.c - System-dependent procedures for setting up
@@ -1334,6 +1334,8 @@ get_ether_addr(ipaddr, hwaddr)
* address on the same subnet as `ipaddr'.
*/
for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
+ if (ifa->ifa_addr == NULL)
+ continue;
if (ifa->ifa_addr->sa_family == AF_INET) {
ina = ((struct sockaddr_in *)ifa->ifa_addr)->sin_addr.s_addr;
/*
@@ -1367,6 +1369,8 @@ get_ether_addr(ipaddr, hwaddr)
*/
ifp = ifa;
for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
+ if (ifa->ifa_addr == NULL)
+ continue;
if (strcmp(ifp->ifa_name, ifa->ifa_name) == 0
&& ifa->ifa_addr->sa_family == AF_LINK) {
/*
@@ -1418,8 +1422,9 @@ GetMask(addr)
/*
* Check the interface's internet address.
*/
- if (ifa->ifa_addr->sa_family != AF_INET)
- continue;
+ if (ifa->ifa_addr == NULL ||
+ ifa->ifa_addr->sa_family != AF_INET)
+ continue;
ina = ((struct sockaddr_in *)ifa->ifa_addr)->sin_addr.s_addr;
if ((ntohl(ina) & nmask) != (addr & nmask))
continue;