From 315b80bb55313675c3b89341490a949fff5d0764 Mon Sep 17 00:00:00 2001 From: florian Date: Sun, 2 Jun 2024 13:35:52 +0000 Subject: [PATCH] DHCPv6 is not concerned with link layer addresses. pointed out by martijn --- sbin/dhcp6leased/control.c | 3 +-- sbin/dhcp6leased/dhcp6leased.c | 3 +-- sbin/dhcp6leased/dhcp6leased.h | 3 +-- sbin/dhcp6leased/engine.c | 12 +----------- sbin/dhcp6leased/frontend.c | 22 +--------------------- sbin/dhcp6leased/parse.y | 3 +-- sbin/dhcp6leased/printconf.c | 3 +-- 7 files changed, 7 insertions(+), 42 deletions(-) diff --git a/sbin/dhcp6leased/control.c b/sbin/dhcp6leased/control.c index 9ded3132d13..5bc63c11af5 100644 --- a/sbin/dhcp6leased/control.c +++ b/sbin/dhcp6leased/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.1 2024/06/02 12:28:05 florian Exp $ */ +/* $OpenBSD: control.c,v 1.2 2024/06/02 13:35:52 florian Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -24,7 +24,6 @@ #include #include -#include #include #include diff --git a/sbin/dhcp6leased/dhcp6leased.c b/sbin/dhcp6leased/dhcp6leased.c index 0165e350088..1884fb6516c 100644 --- a/sbin/dhcp6leased/dhcp6leased.c +++ b/sbin/dhcp6leased/dhcp6leased.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhcp6leased.c,v 1.1 2024/06/02 12:28:05 florian Exp $ */ +/* $OpenBSD: dhcp6leased.c,v 1.2 2024/06/02 13:35:52 florian Exp $ */ /* * Copyright (c) 2017, 2021, 2024 Florian Obser @@ -32,7 +32,6 @@ #include #include #include -#include #include #include diff --git a/sbin/dhcp6leased/dhcp6leased.h b/sbin/dhcp6leased/dhcp6leased.h index dc3c825f1e4..e974657d87e 100644 --- a/sbin/dhcp6leased/dhcp6leased.h +++ b/sbin/dhcp6leased/dhcp6leased.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dhcp6leased.h,v 1.2 2024/06/02 12:41:46 florian Exp $ */ +/* $OpenBSD: dhcp6leased.h,v 1.3 2024/06/02 13:35:52 florian Exp $ */ /* * Copyright (c) 2017, 2021 Florian Obser @@ -217,7 +217,6 @@ struct imsg_ifinfo { int rdomain; int running; int link_state; - struct ether_addr hw_address; char lease[LEASE_SIZE]; }; diff --git a/sbin/dhcp6leased/engine.c b/sbin/dhcp6leased/engine.c index 96514feba0c..2a18022b857 100644 --- a/sbin/dhcp6leased/engine.c +++ b/sbin/dhcp6leased/engine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: engine.c,v 1.2 2024/06/02 12:41:46 florian Exp $ */ +/* $OpenBSD: engine.c,v 1.3 2024/06/02 13:35:52 florian Exp $ */ /* * Copyright (c) 2017, 2021, 2024 Florian Obser @@ -30,7 +30,6 @@ #include #include #include -#include #include #include @@ -93,7 +92,6 @@ struct dhcp6leased_iface { uint32_t if_index; int rdomain; int running; - struct ether_addr hw_address; int link_state; uint8_t xid[XID_SIZE]; int serverid_len; @@ -604,17 +602,9 @@ engine_update_iface(struct imsg_ifinfo *imsg_ifinfo) iface->rdomain = imsg_ifinfo->rdomain; iface->running = imsg_ifinfo->running; iface->link_state = imsg_ifinfo->link_state; - memcpy(&iface->hw_address, &imsg_ifinfo->hw_address, - sizeof(struct ether_addr)); LIST_INSERT_HEAD(&dhcp6leased_interfaces, iface, entries); need_refresh = 1; } else { - if (memcmp(&iface->hw_address, &imsg_ifinfo->hw_address, - sizeof(struct ether_addr)) != 0) { - memcpy(&iface->hw_address, &imsg_ifinfo->hw_address, - sizeof(struct ether_addr)); - need_refresh = 1; - } if (imsg_ifinfo->rdomain != iface->rdomain) { iface->rdomain = imsg_ifinfo->rdomain; need_refresh = 1; diff --git a/sbin/dhcp6leased/frontend.c b/sbin/dhcp6leased/frontend.c index 3fd768fca64..94f5ff09b23 100644 --- a/sbin/dhcp6leased/frontend.c +++ b/sbin/dhcp6leased/frontend.c @@ -1,4 +1,4 @@ -/* $OpenBSD: frontend.c,v 1.2 2024/06/02 12:41:46 florian Exp $ */ +/* $OpenBSD: frontend.c,v 1.3 2024/06/02 13:35:52 florian Exp $ */ /* * Copyright (c) 2017, 2021, 2024 Florian Obser @@ -32,7 +32,6 @@ #include #include -#include #include #include @@ -555,15 +554,6 @@ update_iface(uint32_t if_index) switch (ifa->ifa_addr->sa_family) { case AF_LINK: { struct if_data *if_data; - struct sockaddr_dl *sdl; - - sdl = (struct sockaddr_dl *)ifa->ifa_addr; - if ((sdl->sdl_type != IFT_ETHER && - sdl->sdl_type != IFT_CARP) || - sdl->sdl_alen != ETHER_ADDR_LEN) - continue; - memcpy(ifinfo.hw_address.ether_addr_octet, - LLADDR(sdl), ETHER_ADDR_LEN); if_data = (struct if_data *)ifa->ifa_data; ifinfo.link_state = if_data->ifi_link_state; @@ -580,7 +570,6 @@ update_iface(uint32_t if_index) if (iface == NULL) { if ((iface = calloc(1, sizeof(*iface))) == NULL) fatal("calloc"); - //iface->send_solicit = 1; memcpy(&iface->ifinfo, &ifinfo, sizeof(iface->ifinfo)); LIST_INSERT_HEAD(&interfaces, iface, entries); frontend_imsg_compose_main(IMSG_OPEN_UDPSOCK, 0, @@ -628,15 +617,6 @@ XXX ifinfo.running = (flags & (IFF_UP | IFF_RUNNING)) == (IFF_UP | IFF_RUNNING); - if (sdl != NULL && (sdl->sdl_type == IFT_ETHER || - sdl->sdl_type == IFT_CARP) && sdl->sdl_alen == ETHER_ADDR_LEN) - memcpy(ifinfo.hw_address.ether_addr_octet, LLADDR(sdl), - ETHER_ADDR_LEN); - else if (iface == NULL) { - log_warnx("Could not find AF_LINK address for %s.", if_name); - return; - } - if (iface == NULL) { if ((iface = calloc(1, sizeof(*iface))) == NULL) fatal("calloc"); diff --git a/sbin/dhcp6leased/parse.y b/sbin/dhcp6leased/parse.y index 8fb7778fa3b..08943ef345e 100644 --- a/sbin/dhcp6leased/parse.y +++ b/sbin/dhcp6leased/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.1 2024/06/02 12:28:05 florian Exp $ */ +/* $OpenBSD: parse.y,v 1.2 2024/06/02 13:35:52 florian Exp $ */ /* * Copyright (c) 2018, 2024 Florian Obser @@ -31,7 +31,6 @@ #include #include -#include #include diff --git a/sbin/dhcp6leased/printconf.c b/sbin/dhcp6leased/printconf.c index a38a652658e..7f69e2d7ca9 100644 --- a/sbin/dhcp6leased/printconf.c +++ b/sbin/dhcp6leased/printconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: printconf.c,v 1.1 2024/06/02 12:28:05 florian Exp $ */ +/* $OpenBSD: printconf.c,v 1.2 2024/06/02 13:35:52 florian Exp $ */ /* * Copyright (c) 2024 Florian Obser @@ -25,7 +25,6 @@ #include #include -#include #include -- 2.20.1