1 /* $NetBSD: ifconfig.c,v 1.34 1997/04/21 01:17:58 lukem Exp $ */
5 * Copyright (c) 1997 Jason R. Thorpe.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed for the NetBSD Project
20 * 4. The name of the author may not be used to endorse or promote products
21 * derived from this software without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
30 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
31 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 * Copyright (c) 1983, 1993
38 * The Regents of the University of California. All rights reserved.
40 * Redistribution and use in source and binary forms, with or without
41 * modification, are permitted provided that the following conditions
43 * 1. Redistributions of source code must retain the above copyright
44 * notice, this list of conditions and the following disclaimer.
45 * 2. Redistributions in binary form must reproduce the above copyright
46 * notice, this list of conditions and the following disclaimer in the
47 * documentation and/or other materials provided with the distribution.
48 * 4. Neither the name of the University nor the names of its contributors
49 * may be used to endorse or promote products derived from this software
50 * without specific prior written permission.
52 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
53 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
54 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
55 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
56 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
57 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
58 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
59 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
60 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
61 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
65 #include <sys/param.h>
66 #include <sys/ioctl.h>
67 #include <sys/socket.h>
68 #include <sys/sysctl.h>
72 #include <net/if_dl.h>
73 #include <net/if_types.h>
74 #include <net/if_media.h>
75 #include <net/route.h>
88 static void domediaopt(const char *, int, int);
89 static int get_media_subtype(int, const char *);
90 static int get_media_mode(int, const char *);
91 static int get_media_options(int, const char *);
92 static int lookup_media_word(struct ifmedia_description *, const char *);
93 static void print_media_word(int, int);
94 static void print_media_word_ifconfig(int);
96 static struct ifmedia_description *get_toptype_desc(int);
97 static struct ifmedia_type_to_subtype *get_toptype_ttos(int);
98 static struct ifmedia_description *get_subtype_desc(int,
99 struct ifmedia_type_to_subtype *ttos);
101 #define IFM_OPMODE(x) \
102 ((x) & (IFM_IEEE80211_ADHOC | IFM_IEEE80211_HOSTAP | \
103 IFM_IEEE80211_IBSS | IFM_IEEE80211_WDS | IFM_IEEE80211_MONITOR | \
105 #define IFM_IEEE80211_STA 0
110 struct ifmediareq ifmr;
113 (void) memset(&ifmr, 0, sizeof(ifmr));
114 (void) strncpy(ifmr.ifm_name, name, sizeof(ifmr.ifm_name));
116 if (ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) < 0) {
118 * Interface doesn't support SIOC{G,S}IFMEDIA.
123 if (ifmr.ifm_count == 0) {
124 warnx("%s: no media types?", name);
128 media_list = (int *)malloc(ifmr.ifm_count * sizeof(int));
129 if (media_list == NULL)
131 ifmr.ifm_ulist = media_list;
133 if (ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) < 0)
134 err(1, "SIOCGIFMEDIA");
137 print_media_word(ifmr.ifm_current, 1);
138 if (ifmr.ifm_active != ifmr.ifm_current) {
141 print_media_word(ifmr.ifm_active, 0);
147 if (ifmr.ifm_status & IFM_AVALID) {
148 printf("\tstatus: ");
149 switch (IFM_TYPE(ifmr.ifm_active)) {
152 if (ifmr.ifm_status & IFM_ACTIVE)
155 printf("no carrier");
160 if (ifmr.ifm_status & IFM_ACTIVE)
167 if (ifmr.ifm_status & IFM_ACTIVE) {
168 /* NB: only sta mode associates */
169 if (IFM_OPMODE(ifmr.ifm_active) == IFM_IEEE80211_STA)
170 printf("associated");
174 printf("no carrier");
180 if (ifmr.ifm_count > 0 && supmedia) {
181 printf("\tsupported media:\n");
182 for (i = 0; i < ifmr.ifm_count; i++) {
184 print_media_word_ifconfig(media_list[i]);
193 ifmedia_getstate(int s)
195 static struct ifmediareq *ifmr = NULL;
199 ifmr = (struct ifmediareq *)malloc(sizeof(struct ifmediareq));
203 (void) memset(ifmr, 0, sizeof(struct ifmediareq));
204 (void) strncpy(ifmr->ifm_name, name,
205 sizeof(ifmr->ifm_name));
208 ifmr->ifm_ulist = NULL;
211 * We must go through the motions of reading all
212 * supported media because we need to know both
213 * the current media type and the top-level type.
216 if (ioctl(s, SIOCGIFMEDIA, (caddr_t)ifmr) < 0) {
217 err(1, "SIOCGIFMEDIA");
220 if (ifmr->ifm_count == 0)
221 errx(1, "%s: no media types?", name);
223 mwords = (int *)malloc(ifmr->ifm_count * sizeof(int));
227 ifmr->ifm_ulist = mwords;
228 if (ioctl(s, SIOCGIFMEDIA, (caddr_t)ifmr) < 0)
229 err(1, "SIOCGIFMEDIA");
236 setifmediacallback(int s, void *arg)
238 struct ifmediareq *ifmr = (struct ifmediareq *)arg;
239 static int did_it = 0;
242 ifr.ifr_media = ifmr->ifm_current;
243 if (ioctl(s, SIOCSIFMEDIA, (caddr_t)&ifr) < 0)
244 err(1, "SIOCSIFMEDIA (media)");
245 free(ifmr->ifm_ulist);
252 setmedia(const char *val, int d, int s, const struct afswtch *afp)
254 struct ifmediareq *ifmr;
257 ifmr = ifmedia_getstate(s);
260 * We are primarily concerned with the top-level type.
261 * However, "current" may be only IFM_NONE, so we just look
262 * for the top-level type in the first "supported type"
265 * (I'm assuming that all supported media types for a given
266 * interface will be the same top-level type..)
268 subtype = get_media_subtype(IFM_TYPE(ifmr->ifm_ulist[0]), val);
270 strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
271 ifr.ifr_media = (ifmr->ifm_current & IFM_IMASK) |
272 IFM_TYPE(ifmr->ifm_ulist[0]) | subtype;
274 ifmr->ifm_current = ifr.ifr_media;
275 callback_register(setifmediacallback, (void *)ifmr);
279 setmediaopt(const char *val, int d, int s, const struct afswtch *afp)
282 domediaopt(val, 0, s);
286 unsetmediaopt(const char *val, int d, int s, const struct afswtch *afp)
289 domediaopt(val, 1, s);
293 domediaopt(const char *val, int clear, int s)
295 struct ifmediareq *ifmr;
298 ifmr = ifmedia_getstate(s);
300 options = get_media_options(IFM_TYPE(ifmr->ifm_ulist[0]), val);
302 strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
303 ifr.ifr_media = ifmr->ifm_current;
305 ifr.ifr_media &= ~options;
307 if (options & IFM_HDX) {
308 ifr.ifr_media &= ~IFM_FDX;
311 ifr.ifr_media |= options;
313 ifmr->ifm_current = ifr.ifr_media;
314 callback_register(setifmediacallback, (void *)ifmr);
318 setmediainst(const char *val, int d, int s, const struct afswtch *afp)
320 struct ifmediareq *ifmr;
323 ifmr = ifmedia_getstate(s);
326 if (inst < 0 || inst > (int)IFM_INST_MAX)
327 errx(1, "invalid media instance: %s", val);
329 strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
330 ifr.ifr_media = (ifmr->ifm_current & ~IFM_IMASK) | inst << IFM_ISHIFT;
332 ifmr->ifm_current = ifr.ifr_media;
333 callback_register(setifmediacallback, (void *)ifmr);
337 setmediamode(const char *val, int d, int s, const struct afswtch *afp)
339 struct ifmediareq *ifmr;
342 ifmr = ifmedia_getstate(s);
344 mode = get_media_mode(IFM_TYPE(ifmr->ifm_ulist[0]), val);
346 strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
347 ifr.ifr_media = (ifmr->ifm_current & ~IFM_MMASK) | mode;
349 ifmr->ifm_current = ifr.ifr_media;
350 callback_register(setifmediacallback, (void *)ifmr);
353 /**********************************************************************
354 * A good chunk of this is duplicated from sys/net/ifmedia.c
355 **********************************************************************/
357 static struct ifmedia_description ifm_type_descriptions[] =
358 IFM_TYPE_DESCRIPTIONS;
360 static struct ifmedia_description ifm_subtype_ethernet_descriptions[] =
361 IFM_SUBTYPE_ETHERNET_DESCRIPTIONS;
363 static struct ifmedia_description ifm_subtype_ethernet_aliases[] =
364 IFM_SUBTYPE_ETHERNET_ALIASES;
366 static struct ifmedia_description ifm_subtype_ethernet_option_descriptions[] =
367 IFM_SUBTYPE_ETHERNET_OPTION_DESCRIPTIONS;
369 static struct ifmedia_description ifm_subtype_tokenring_descriptions[] =
370 IFM_SUBTYPE_TOKENRING_DESCRIPTIONS;
372 static struct ifmedia_description ifm_subtype_tokenring_aliases[] =
373 IFM_SUBTYPE_TOKENRING_ALIASES;
375 static struct ifmedia_description ifm_subtype_tokenring_option_descriptions[] =
376 IFM_SUBTYPE_TOKENRING_OPTION_DESCRIPTIONS;
378 static struct ifmedia_description ifm_subtype_fddi_descriptions[] =
379 IFM_SUBTYPE_FDDI_DESCRIPTIONS;
381 static struct ifmedia_description ifm_subtype_fddi_aliases[] =
382 IFM_SUBTYPE_FDDI_ALIASES;
384 static struct ifmedia_description ifm_subtype_fddi_option_descriptions[] =
385 IFM_SUBTYPE_FDDI_OPTION_DESCRIPTIONS;
387 static struct ifmedia_description ifm_subtype_ieee80211_descriptions[] =
388 IFM_SUBTYPE_IEEE80211_DESCRIPTIONS;
390 static struct ifmedia_description ifm_subtype_ieee80211_aliases[] =
391 IFM_SUBTYPE_IEEE80211_ALIASES;
393 static struct ifmedia_description ifm_subtype_ieee80211_option_descriptions[] =
394 IFM_SUBTYPE_IEEE80211_OPTION_DESCRIPTIONS;
396 struct ifmedia_description ifm_subtype_ieee80211_mode_descriptions[] =
397 IFM_SUBTYPE_IEEE80211_MODE_DESCRIPTIONS;
399 struct ifmedia_description ifm_subtype_ieee80211_mode_aliases[] =
400 IFM_SUBTYPE_IEEE80211_MODE_ALIASES;
402 static struct ifmedia_description ifm_subtype_atm_descriptions[] =
403 IFM_SUBTYPE_ATM_DESCRIPTIONS;
405 static struct ifmedia_description ifm_subtype_atm_aliases[] =
406 IFM_SUBTYPE_ATM_ALIASES;
408 static struct ifmedia_description ifm_subtype_atm_option_descriptions[] =
409 IFM_SUBTYPE_ATM_OPTION_DESCRIPTIONS;
411 static struct ifmedia_description ifm_subtype_shared_descriptions[] =
412 IFM_SUBTYPE_SHARED_DESCRIPTIONS;
414 static struct ifmedia_description ifm_subtype_shared_aliases[] =
415 IFM_SUBTYPE_SHARED_ALIASES;
417 static struct ifmedia_description ifm_shared_option_descriptions[] =
418 IFM_SHARED_OPTION_DESCRIPTIONS;
420 static struct ifmedia_description ifm_shared_option_aliases[] =
421 IFM_SHARED_OPTION_ALIASES;
423 struct ifmedia_type_to_subtype {
425 struct ifmedia_description *desc;
429 struct ifmedia_description *desc;
433 struct ifmedia_description *desc;
438 /* must be in the same order as IFM_TYPE_DESCRIPTIONS */
439 static struct ifmedia_type_to_subtype ifmedia_types_to_subtypes[] = {
442 { &ifm_subtype_shared_descriptions[0], 0 },
443 { &ifm_subtype_shared_aliases[0], 1 },
444 { &ifm_subtype_ethernet_descriptions[0], 0 },
445 { &ifm_subtype_ethernet_aliases[0], 1 },
449 { &ifm_shared_option_descriptions[0], 0 },
450 { &ifm_shared_option_aliases[0], 1 },
451 { &ifm_subtype_ethernet_option_descriptions[0], 0 },
460 { &ifm_subtype_shared_descriptions[0], 0 },
461 { &ifm_subtype_shared_aliases[0], 1 },
462 { &ifm_subtype_tokenring_descriptions[0], 0 },
463 { &ifm_subtype_tokenring_aliases[0], 1 },
467 { &ifm_shared_option_descriptions[0], 0 },
468 { &ifm_shared_option_aliases[0], 1 },
469 { &ifm_subtype_tokenring_option_descriptions[0], 0 },
478 { &ifm_subtype_shared_descriptions[0], 0 },
479 { &ifm_subtype_shared_aliases[0], 1 },
480 { &ifm_subtype_fddi_descriptions[0], 0 },
481 { &ifm_subtype_fddi_aliases[0], 1 },
485 { &ifm_shared_option_descriptions[0], 0 },
486 { &ifm_shared_option_aliases[0], 1 },
487 { &ifm_subtype_fddi_option_descriptions[0], 0 },
496 { &ifm_subtype_shared_descriptions[0], 0 },
497 { &ifm_subtype_shared_aliases[0], 1 },
498 { &ifm_subtype_ieee80211_descriptions[0], 0 },
499 { &ifm_subtype_ieee80211_aliases[0], 1 },
503 { &ifm_shared_option_descriptions[0], 0 },
504 { &ifm_shared_option_aliases[0], 1 },
505 { &ifm_subtype_ieee80211_option_descriptions[0], 0 },
509 { &ifm_subtype_ieee80211_mode_descriptions[0], 0 },
510 { &ifm_subtype_ieee80211_mode_aliases[0], 0 },
516 { &ifm_subtype_shared_descriptions[0], 0 },
517 { &ifm_subtype_shared_aliases[0], 1 },
518 { &ifm_subtype_atm_descriptions[0], 0 },
519 { &ifm_subtype_atm_aliases[0], 1 },
523 { &ifm_shared_option_descriptions[0], 0 },
524 { &ifm_shared_option_aliases[0], 1 },
525 { &ifm_subtype_atm_option_descriptions[0], 0 },
535 get_media_subtype(int type, const char *val)
537 struct ifmedia_description *desc;
538 struct ifmedia_type_to_subtype *ttos;
541 /* Find the top-level interface type. */
542 for (desc = ifm_type_descriptions, ttos = ifmedia_types_to_subtypes;
543 desc->ifmt_string != NULL; desc++, ttos++)
544 if (type == desc->ifmt_word)
546 if (desc->ifmt_string == NULL)
547 errx(1, "unknown media type 0x%x", type);
549 for (i = 0; ttos->subtypes[i].desc != NULL; i++) {
550 rval = lookup_media_word(ttos->subtypes[i].desc, val);
554 errx(1, "unknown media subtype: %s", val);
559 get_media_mode(int type, const char *val)
561 struct ifmedia_description *desc;
562 struct ifmedia_type_to_subtype *ttos;
565 /* Find the top-level interface type. */
566 for (desc = ifm_type_descriptions, ttos = ifmedia_types_to_subtypes;
567 desc->ifmt_string != NULL; desc++, ttos++)
568 if (type == desc->ifmt_word)
570 if (desc->ifmt_string == NULL)
571 errx(1, "unknown media mode 0x%x", type);
573 for (i = 0; ttos->modes[i].desc != NULL; i++) {
574 rval = lookup_media_word(ttos->modes[i].desc, val);
582 get_media_options(int type, const char *val)
584 struct ifmedia_description *desc;
585 struct ifmedia_type_to_subtype *ttos;
586 char *optlist, *optptr;
587 int option = 0, i, rval = 0;
589 /* We muck with the string, so copy it. */
590 optlist = strdup(val);
594 /* Find the top-level interface type. */
595 for (desc = ifm_type_descriptions, ttos = ifmedia_types_to_subtypes;
596 desc->ifmt_string != NULL; desc++, ttos++)
597 if (type == desc->ifmt_word)
599 if (desc->ifmt_string == NULL)
600 errx(1, "unknown media type 0x%x", type);
603 * Look up the options in the user-provided comma-separated
607 for (; (optptr = strtok(optptr, ",")) != NULL; optptr = NULL) {
608 for (i = 0; ttos->options[i].desc != NULL; i++) {
609 option = lookup_media_word(ttos->options[i].desc, optptr);
614 errx(1, "unknown option: %s", optptr);
623 lookup_media_word(struct ifmedia_description *desc, const char *val)
626 for (; desc->ifmt_string != NULL; desc++)
627 if (strcasecmp(desc->ifmt_string, val) == 0)
628 return (desc->ifmt_word);
633 static struct ifmedia_description *get_toptype_desc(int ifmw)
635 struct ifmedia_description *desc;
637 for (desc = ifm_type_descriptions; desc->ifmt_string != NULL; desc++)
638 if (IFM_TYPE(ifmw) == desc->ifmt_word)
644 static struct ifmedia_type_to_subtype *get_toptype_ttos(int ifmw)
646 struct ifmedia_description *desc;
647 struct ifmedia_type_to_subtype *ttos;
649 for (desc = ifm_type_descriptions, ttos = ifmedia_types_to_subtypes;
650 desc->ifmt_string != NULL; desc++, ttos++)
651 if (IFM_TYPE(ifmw) == desc->ifmt_word)
657 static struct ifmedia_description *get_subtype_desc(int ifmw,
658 struct ifmedia_type_to_subtype *ttos)
661 struct ifmedia_description *desc;
663 for (i = 0; ttos->subtypes[i].desc != NULL; i++) {
664 if (ttos->subtypes[i].alias)
666 for (desc = ttos->subtypes[i].desc;
667 desc->ifmt_string != NULL; desc++) {
668 if (IFM_SUBTYPE(ifmw) == desc->ifmt_word)
676 static struct ifmedia_description *get_mode_desc(int ifmw,
677 struct ifmedia_type_to_subtype *ttos)
680 struct ifmedia_description *desc;
682 for (i = 0; ttos->modes[i].desc != NULL; i++) {
683 if (ttos->modes[i].alias)
685 for (desc = ttos->modes[i].desc;
686 desc->ifmt_string != NULL; desc++) {
687 if (IFM_MODE(ifmw) == desc->ifmt_word)
696 print_media_word(int ifmw, int print_toptype)
698 struct ifmedia_description *desc;
699 struct ifmedia_type_to_subtype *ttos;
700 int seen_option = 0, i;
702 /* Find the top-level interface type. */
703 desc = get_toptype_desc(ifmw);
704 ttos = get_toptype_ttos(ifmw);
705 if (desc->ifmt_string == NULL) {
706 printf("<unknown type>");
708 } else if (print_toptype) {
709 printf("%s", desc->ifmt_string);
713 * Don't print the top-level type; it's not like we can
714 * change it, or anything.
718 desc = get_subtype_desc(ifmw, ttos);
720 printf("<unknown subtype>");
727 printf("%s", desc->ifmt_string);
730 desc = get_mode_desc(ifmw, ttos);
731 if (desc != NULL && strcasecmp("autoselect", desc->ifmt_string))
732 printf(" mode %s", desc->ifmt_string);
736 for (i = 0; ttos->options[i].desc != NULL; i++) {
737 if (ttos->options[i].alias)
739 for (desc = ttos->options[i].desc;
740 desc->ifmt_string != NULL; desc++) {
741 if (ifmw & desc->ifmt_word) {
742 if (seen_option == 0)
744 printf("%s%s", seen_option++ ? "," : "",
749 printf("%s", seen_option ? ">" : "");
751 if (print_toptype && IFM_INST(ifmw) != 0)
752 printf(" instance %d", IFM_INST(ifmw));
756 print_media_word_ifconfig(int ifmw)
758 struct ifmedia_description *desc;
759 struct ifmedia_type_to_subtype *ttos;
760 int seen_option = 0, i;
762 /* Find the top-level interface type. */
763 desc = get_toptype_desc(ifmw);
764 ttos = get_toptype_ttos(ifmw);
765 if (desc->ifmt_string == NULL) {
766 printf("<unknown type>");
771 * Don't print the top-level type; it's not like we can
772 * change it, or anything.
776 desc = get_subtype_desc(ifmw, ttos);
778 printf("<unknown subtype>");
782 printf("media %s", desc->ifmt_string);
784 desc = get_mode_desc(ifmw, ttos);
786 printf(" mode %s", desc->ifmt_string);
789 for (i = 0; ttos->options[i].desc != NULL; i++) {
790 if (ttos->options[i].alias)
792 for (desc = ttos->options[i].desc;
793 desc->ifmt_string != NULL; desc++) {
794 if (ifmw & desc->ifmt_word) {
795 if (seen_option == 0)
796 printf(" mediaopt ");
797 printf("%s%s", seen_option++ ? "," : "",
803 if (IFM_INST(ifmw) != 0)
804 printf(" instance %d", IFM_INST(ifmw));
807 /**********************************************************************
809 **********************************************************************/
811 static struct cmd media_cmds[] = {
812 DEF_CMD_ARG("media", setmedia),
813 DEF_CMD_ARG("mode", setmediamode),
814 DEF_CMD_ARG("mediaopt", setmediaopt),
815 DEF_CMD_ARG("-mediaopt",unsetmediaopt),
816 DEF_CMD_ARG("inst", setmediainst),
817 DEF_CMD_ARG("instance", setmediainst),
819 static struct afswtch af_media = {
820 .af_name = "af_media",
822 .af_other_status = media_status,
825 static __constructor void
830 for (i = 0; i < nitems(media_cmds); i++)
831 cmd_register(&media_cmds[i]);
832 af_register(&af_media);