]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
bsd: fix use of ifmediareq for OpenBSD
authorVincent Bernat <vincent@bernat.im>
Mon, 13 Jun 2016 06:43:11 +0000 (08:43 +0200)
committerVincent Bernat <vincent@bernat.im>
Mon, 13 Jun 2016 06:43:11 +0000 (08:43 +0200)
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

index 9cee2e6a48fecd892d6b8a842af7507cd585f588..3adaff1d51a4146c622c3f73af90bf82274eecf5 100644 (file)
@@ -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;