From: florian Date: Tue, 2 Jul 2024 17:41:27 +0000 (+0000) Subject: Use correct idiom to get mac addresses from ethernet-like interfaces. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=11d381874a35ef1e6c970c722b1d610abef71698;p=openbsd Use correct idiom to get mac addresses from ethernet-like interfaces. This unbreaks rad(8) on top of carp(4). OK deraadt, bluhm --- diff --git a/usr.sbin/rad/frontend.c b/usr.sbin/rad/frontend.c index e0beb335295..c700c079e6d 100644 --- a/usr.sbin/rad/frontend.c +++ b/usr.sbin/rad/frontend.c @@ -1,4 +1,4 @@ -/* $OpenBSD: frontend.c,v 1.48 2024/05/31 16:10:42 florian Exp $ */ +/* $OpenBSD: frontend.c,v 1.49 2024/07/02 17:41:27 florian Exp $ */ /* * Copyright (c) 2018 Florian Obser @@ -777,8 +777,9 @@ merge_ra_interface(char *if_name, char *conf_name, struct ifaddrs *ifap) link_state = ((struct if_data*)ifa->ifa_data)->ifi_link_state; sdl = (struct sockaddr_dl *)ifa->ifa_addr; - if (sdl->sdl_type == IFT_ETHER && - sdl->sdl_alen == ETHER_ADDR_LEN) { + if (sdl != NULL && (sdl->sdl_type == IFT_ETHER || + sdl->sdl_type == IFT_CARP) && sdl->sdl_alen == + ETHER_ADDR_LEN) { has_hw_addr = 1; memcpy(&hw_addr, LLADDR(sdl), ETHER_ADDR_LEN); }