Index | Thread | Search

From:
Alexander Bluhm <bluhm@openbsd.org>
Subject:
Re: rad(8): fix carp
To:
tech <tech@openbsd.org>
Date:
Tue, 2 Jul 2024 19:24:42 +0200

Download raw body.

Thread
  • Florian Obser:

    rad(8): fix carp

    • Alexander Bluhm:

      rad(8): fix carp

On Tue, Jul 02, 2024 at 06:39:14PM +0200, Florian Obser wrote:
> This is the correct idiom to get the mac address of ethernet-like
> network interfaces.
> 
> Sorry, this was my fault to not spot it earlier.
> 
> OK?

OK bluhm@

> diff --git frontend.c frontend.c
> index e0beb335295..042cee9908e 100644
> --- frontend.c
> +++ frontend.c
> @@ -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);
>  			}
> 
> -- 
> In my defence, I have been left unsupervised.