From 4b68fbd1711d1d4d2c7e77e04ffc47257366ac90 Mon Sep 17 00:00:00 2001 From: rpokala Date: Thu, 18 May 2017 23:41:34 +0000 Subject: Persistently store NIC's hardware MAC address, and add a way to retrive it jhb pointed out that (struct ifnet) is part of the network driver KBI, and thus the offsets of internal fields must not change. Therefore, move the new "if_hw_addr" field to the end, and consume one of the "if_pspare"s; that's what they're there for. Because netmap on stable/10 uses "if_pspare[0]", the new field replaces the *last* element of that array; that way, offsetof(if_pspare) is unchanged compared to before r318430. PR: 194386 Reviewed by: jhb Pointyhat to: rpokala Sponsored by: Panasas (cherry picked from commit 2f103d239c07e4f88b9852f3b8689f100d7a31d0) --- sys/net/if_var.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/net/if_var.h b/sys/net/if_var.h index 57d7028..6027546 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -200,7 +200,6 @@ struct ifnet { (struct ifnet *, struct vnet *, char *); struct vnet *if_home_vnet; /* where this ifnet originates from */ struct ifaddr *if_addr; /* pointer to link-level address */ - void *if_hw_addr; /* hardware link-level address */ void *if_llsoftc; /* link layer softc */ int if_drv_flags; /* driver-managed status flags */ struct ifaltq if_snd; /* output queue (includes altq) */ @@ -260,7 +259,8 @@ struct ifnet { */ u_int if_hw_tsomaxsegcount; /* TSO maximum segment count */ u_int if_hw_tsomaxsegsize; /* TSO maximum segment size in bytes */ - void *if_pspare[8]; /* 1 netmap, 7 TDB */ + void *if_pspare[7]; /* 1 netmap, 6 TDB */ + void *if_hw_addr; /* hardware link-level address */ }; typedef void if_init_f_t(void *); -- cgit v1.1