From af21a0e1074dcba8f0c202fb10e7f1c06e92a025 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Mon, 13 Jun 2016 08:43:11 +0200 Subject: [PATCH] bsd: fix use of ifmediareq for OpenBSD They changed the struct. Other BSD didn't. Use of "typeof()" to circumvent this. http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/net/if.h#rev1.167 --- src/daemon/interfaces-bsd.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/daemon/interfaces-bsd.c b/src/daemon/interfaces-bsd.c index 9cee2e6a..3adaff1d 100644 --- a/src/daemon/interfaces-bsd.c +++ b/src/daemon/interfaces-bsd.c @@ -469,11 +469,10 @@ ifbsd_macphy(struct lldpd *cfg, struct lldpd_hardware *hardware) { #ifdef ENABLE_DOT3 - int media_list[32] = {}; - struct ifmediareq ifmr = { - .ifm_ulist = media_list, - .ifm_count = sizeof(media_list) / sizeof(int) - }; + struct ifmediareq ifmr = {}; + typeof(ifmr.ifm_ulist[0]) media_list[32] = {}; + ifmr.ifm_ulist = media_list; + ifmr.ifm_count = 32; struct lldpd_port *port = &hardware->h_lport; unsigned int duplex; unsigned int media; -- 2.39.5