summaryrefslogtreecommitdiffstats
path: root/sbin/ifconfig/ifmac.c
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2004-12-08 19:18:07 +0000
committersam <sam@FreeBSD.org>2004-12-08 19:18:07 +0000
commit68cd8761a723205e9d0dbd54067af7db9f163492 (patch)
tree65f511158298939a14f40a9fccf4ecc68b18c48a /sbin/ifconfig/ifmac.c
parentf947a8cc1cf9e160deab254a7ff4be233c0f56d3 (diff)
downloadFreeBSD-src-68cd8761a723205e9d0dbd54067af7db9f163492.zip
FreeBSD-src-68cd8761a723205e9d0dbd54067af7db9f163492.tar.gz
Overhaul to cleanup some of the tangled logic that's grown over the years.
o break per-address family support out into separate files o modularize per-address family and functional operations using a registration mechanism; this permits configuration according to which files you include (but beware that order of the files is important to insure backwards compatibility) o many cleanups to eliminate incestuous behaviour, global variables, and poor coding practices (still much more to fix) The original motivation of this work was to support dynamic addition of functionality based on the interface so we can eliminate the various little control programs and so that vendors can distribute ifconfig plugins that support their in-kernel code. That work is still to be completed. o Update 802.11 support for all the new net80211 functionality; some of these operations (e.g. list *) may be better suited in a different program
Diffstat (limited to 'sbin/ifconfig/ifmac.c')
-rw-r--r--sbin/ifconfig/ifmac.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/sbin/ifconfig/ifmac.c b/sbin/ifconfig/ifmac.c
index 41b718b..4e5de09 100644
--- a/sbin/ifconfig/ifmac.c
+++ b/sbin/ifconfig/ifmac.c
@@ -49,8 +49,8 @@
#include "ifconfig.h"
-void
-maclabel_status(int s, struct rt_addrinfo *info)
+static void
+maclabel_status(int s, const struct rt_addrinfo *info)
{
struct ifreq ifr;
mac_t label;
@@ -77,7 +77,7 @@ mac_free:
mac_free(label);
}
-void
+static void
setifmaclabel(const char *val, int d, int s, const struct afswtch *rafp)
{
struct ifreq ifr;
@@ -98,3 +98,24 @@ setifmaclabel(const char *val, int d, int s, const struct afswtch *rafp)
if (error == -1)
perror("setifmac");
}
+
+static struct cmd mac_cmds[] = {
+ DEF_CMD_ARG("maclabel", setifmaclabel),
+};
+static struct afswtch af_mac = {
+ .af_name = "af_maclabel",
+ .af_af = AF_UNSPEC,
+ .af_status = maclabel_status,
+};
+
+static __constructor void
+mac_ctor(void)
+{
+#define N(a) (sizeof(a) / sizeof(a[0]))
+ int i;
+
+ for (i = 0; i < N(mac_cmds); i++)
+ cmd_register(&mac_cmds[i]);
+ af_register(&af_mac);
+#undef N
+}
OpenPOWER on IntegriCloud