Lines Matching +full:sub +full:-

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
87 * The list of all virtual wireless interfaces - sorted by name.
167 asn_oid *, uint sub, struct wlan_iface **, uint32_t *);
179 uint sub, struct wlan_iface **);
188 static int wlan_scanr_index_decode(const struct asn_oid *oid, uint sub,
217 op_wlan_iface(struct snmp_context *ctx, struct snmp_value *val, uint32_t sub, in op_wlan_iface() argument
228 if ((wif = wlan_get_snmp_interface(&val->var, sub)) == NULL) in op_wlan_iface()
233 if ((wif = wlan_get_next_snmp_interface(&val->var, sub)) == NULL) in op_wlan_iface()
235 wlan_append_ifindex(&val->var, sub, wif); in op_wlan_iface()
239 if ((wif = wlan_get_snmp_interface(&val->var, sub)) == NULL) { in op_wlan_iface()
240 if (val->var.subs[sub - 1] != LEAF_wlanIfaceName) in op_wlan_iface()
242 if (wlan_get_ifname(&val->var, sub, wname) == NULL) in op_wlan_iface()
246 wif->internal = 1; in op_wlan_iface()
248 if (wif->status == RowStatus_active && in op_wlan_iface()
249 val->var.subs[sub - 1] != LEAF_wlanIfaceStatus && in op_wlan_iface()
250 val->var.subs[sub - 1] != LEAF_wlanIfaceState) in op_wlan_iface()
253 switch (val->var.subs[sub - 1]) { in op_wlan_iface()
258 if (val->v.octetstring.len >= IFNAMSIZ) in op_wlan_iface()
260 if ((ctx->scratch->ptr1 = malloc(IFNAMSIZ)) == NULL) in op_wlan_iface()
262 strlcpy(ctx->scratch->ptr1, wif->wname, IFNAMSIZ); in op_wlan_iface()
263 memcpy(wif->wname, val->v.octetstring.octets, in op_wlan_iface()
264 val->v.octetstring.len); in op_wlan_iface()
265 wif->wname[val->v.octetstring.len] = '\0'; in op_wlan_iface()
269 if (val->v.octetstring.len >= IFNAMSIZ) in op_wlan_iface()
271 if ((ctx->scratch->ptr1 = malloc(IFNAMSIZ)) == NULL) in op_wlan_iface()
273 strlcpy(ctx->scratch->ptr1, wif->pname, IFNAMSIZ); in op_wlan_iface()
274 memcpy(wif->pname, val->v.octetstring.octets, in op_wlan_iface()
275 val->v.octetstring.len); in op_wlan_iface()
276 wif->pname[val->v.octetstring.len] = '\0'; in op_wlan_iface()
280 ctx->scratch->int1 = wif->mode; in op_wlan_iface()
281 wif->mode = val->v.integer; in op_wlan_iface()
285 if (val->v.octetstring.len > sizeof(wif->flags)) in op_wlan_iface()
287 ctx->scratch->ptr1 = malloc(sizeof(wif->flags)); in op_wlan_iface()
288 if (ctx->scratch->ptr1 == NULL) in op_wlan_iface()
290 memcpy(ctx->scratch->ptr1, (uint8_t *)&wif->flags, in op_wlan_iface()
291 sizeof(wif->flags)); in op_wlan_iface()
292 memcpy((uint8_t *)&wif->flags, val->v.octetstring.octets, in op_wlan_iface()
293 sizeof(wif->flags)); in op_wlan_iface()
297 if (val->v.octetstring.len != IEEE80211_ADDR_LEN) in op_wlan_iface()
299 ctx->scratch->ptr1 = malloc(IEEE80211_ADDR_LEN); in op_wlan_iface()
300 if (ctx->scratch->ptr1 == NULL) in op_wlan_iface()
302 memcpy(ctx->scratch->ptr1, wif->dbssid, in op_wlan_iface()
304 memcpy(wif->dbssid, val->v.octetstring.octets, in op_wlan_iface()
309 if (val->v.octetstring.len != IEEE80211_ADDR_LEN) in op_wlan_iface()
311 ctx->scratch->ptr1 = malloc(IEEE80211_ADDR_LEN); in op_wlan_iface()
312 if (ctx->scratch->ptr1 == NULL) in op_wlan_iface()
314 memcpy(ctx->scratch->ptr1, wif->dlmac, in op_wlan_iface()
316 memcpy(wif->dlmac, val->v.octetstring.octets, in op_wlan_iface()
321 ctx->scratch->int1 = wif->status; in op_wlan_iface()
322 wif->status = val->v.integer; in op_wlan_iface()
323 if (wif->status == RowStatus_active) { in op_wlan_iface()
326 wif->status = ctx->scratch->int1; in op_wlan_iface()
329 } else if (wif->status == RowStatus_destroy) in op_wlan_iface()
332 wif->status = RowStatus_notReady; in op_wlan_iface()
336 ctx->scratch->int1 = wif->state; in op_wlan_iface()
337 wif->state = val->v.integer; in op_wlan_iface()
338 if (wif->status == RowStatus_active) in op_wlan_iface()
346 if ((wif = wlan_get_snmp_interface(&val->var, sub)) == NULL) in op_wlan_iface()
348 switch (val->var.subs[sub - 1]) { in op_wlan_iface()
350 strlcpy(wif->wname, ctx->scratch->ptr1, IFNAMSIZ); in op_wlan_iface()
351 free(ctx->scratch->ptr1); in op_wlan_iface()
355 strlcpy(wif->pname, ctx->scratch->ptr1, IFNAMSIZ); in op_wlan_iface()
356 free(ctx->scratch->ptr1); in op_wlan_iface()
360 wif->mode = ctx->scratch->int1; in op_wlan_iface()
364 memcpy((uint8_t *)&wif->flags, ctx->scratch->ptr1, in op_wlan_iface()
365 sizeof(wif->flags)); in op_wlan_iface()
366 free(ctx->scratch->ptr1); in op_wlan_iface()
370 memcpy(wif->dbssid, ctx->scratch->ptr1, in op_wlan_iface()
372 free(ctx->scratch->ptr1); in op_wlan_iface()
376 memcpy(wif->dlmac, ctx->scratch->ptr1, in op_wlan_iface()
378 free(ctx->scratch->ptr1); in op_wlan_iface()
382 wif->status = ctx->scratch->int1; in op_wlan_iface()
383 if (ctx->scratch->int1 == RowStatus_active) in op_wlan_iface()
385 else if (wif->internal != 0) in op_wlan_iface()
390 wif->state = ctx->scratch->int1; in op_wlan_iface()
391 if (wif->status == RowStatus_active) in op_wlan_iface()
399 switch (val->var.subs[sub - 1]) { in op_wlan_iface()
405 free(ctx->scratch->ptr1); in op_wlan_iface()
414 switch (val->var.subs[sub - 1]) { in op_wlan_iface()
416 val->v.integer = wif->index; in op_wlan_iface()
419 return (string_get(val, wif->wname, -1)); in op_wlan_iface()
421 return (string_get(val, wif->pname, -1)); in op_wlan_iface()
423 val->v.integer = wif->mode; in op_wlan_iface()
426 return (bits_get(val, (uint8_t *)&wif->flags, in op_wlan_iface()
427 sizeof(wif->flags))); in op_wlan_iface()
429 return (string_get(val, wif->dbssid, IEEE80211_ADDR_LEN)); in op_wlan_iface()
431 return (string_get(val, wif->dlmac, IEEE80211_ADDR_LEN)); in op_wlan_iface()
433 val->v.integer = wif->status; in op_wlan_iface()
436 val->v.integer = wif->state; in op_wlan_iface()
445 uint32_t sub, uint32_t iidx __unused, enum snmp_op op) in op_wlan_if_parent() argument
453 if ((wif = wlan_get_interface(&val->var, sub)) == NULL) in op_wlan_if_parent()
457 if ((wif = wlan_get_next_interface(&val->var, sub)) == NULL) in op_wlan_if_parent()
459 wlan_append_ifindex(&val->var, sub, wif); in op_wlan_if_parent()
471 switch (val->var.subs[sub - 1]) { in op_wlan_if_parent()
473 return (bits_get(val, (uint8_t *)&wif->drivercaps, in op_wlan_if_parent()
474 sizeof(wif->drivercaps))); in op_wlan_if_parent()
476 return (bits_get(val, (uint8_t *)&wif->cryptocaps, in op_wlan_if_parent()
477 sizeof(wif->cryptocaps))); in op_wlan_if_parent()
479 return (bits_get(val, (uint8_t *)&wif->htcaps, in op_wlan_if_parent()
480 sizeof(wif->htcaps))); in op_wlan_if_parent()
488 uint32_t sub, uint32_t iidx __unused, enum snmp_op op) in op_wlan_iface_config() argument
498 if ((wif = wlan_get_interface(&val->var, sub)) == NULL) in op_wlan_iface_config()
503 if ((wif = wlan_get_next_interface(&val->var, sub)) == NULL) in op_wlan_iface_config()
505 wlan_append_ifindex(&val->var, sub, wif); in op_wlan_iface_config()
509 if ((wif = wlan_get_interface(&val->var, sub)) == NULL) in op_wlan_iface_config()
512 intval = val->v.integer; in op_wlan_iface_config()
517 switch (val->var.subs[sub - 1]) { in op_wlan_iface_config()
519 if (val->v.octetstring.len != WLAN_COUNTRY_CODE_SIZE) in op_wlan_iface_config()
523 if (val->v.octetstring.len > IEEE80211_NWID_LEN) in op_wlan_iface_config()
527 if (val->v.octetstring.len != IEEE80211_ADDR_LEN) in op_wlan_iface_config()
531 ctx->scratch->int1 = wif->packet_burst; in op_wlan_iface_config()
534 ctx->scratch->int1 = wif->reg_domain; in op_wlan_iface_config()
537 ctx->scratch->int1 = wif->desired_channel; in op_wlan_iface_config()
540 ctx->scratch->int1 = wif->dyn_frequency; in op_wlan_iface_config()
543 ctx->scratch->int1 = wif->fast_frames; in op_wlan_iface_config()
546 ctx->scratch->int1 = wif->dturbo; in op_wlan_iface_config()
549 ctx->scratch->int1 = wif->tx_power; in op_wlan_iface_config()
552 ctx->scratch->int1 = wif->frag_threshold; in op_wlan_iface_config()
555 ctx->scratch->int1 = wif->rts_threshold; in op_wlan_iface_config()
558 ctx->scratch->int1 = wif->priv_subscribe; in op_wlan_iface_config()
561 ctx->scratch->int1 = wif->bg_scan; in op_wlan_iface_config()
564 ctx->scratch->int1 = wif->bg_scan_idle; in op_wlan_iface_config()
567 ctx->scratch->int1 = wif->bg_scan_interval; in op_wlan_iface_config()
570 ctx->scratch->int1 = wif->beacons_missed; in op_wlan_iface_config()
573 ctx->scratch->int1 = wif->roam_mode; in op_wlan_iface_config()
576 ctx->scratch->int1 = wif->dot11d; in op_wlan_iface_config()
579 ctx->scratch->int1 = wif->dot11h; in op_wlan_iface_config()
582 ctx->scratch->int1 = wif->dynamic_wds; in op_wlan_iface_config()
585 ctx->scratch->int1 = wif->power_save; in op_wlan_iface_config()
588 ctx->scratch->int1 = wif->ap_bridge; in op_wlan_iface_config()
591 ctx->scratch->int1 = wif->beacon_interval; in op_wlan_iface_config()
594 ctx->scratch->int1 = wif->dtim_period; in op_wlan_iface_config()
597 ctx->scratch->int1 = wif->hide_ssid; in op_wlan_iface_config()
600 ctx->scratch->int1 = wif->inact_process; in op_wlan_iface_config()
603 ctx->scratch->int1 = wif->do11g_protect; in op_wlan_iface_config()
606 ctx->scratch->int1 = wif->dot11g_pure; in op_wlan_iface_config()
609 ctx->scratch->int1 = wif->dot11n_pure; in op_wlan_iface_config()
612 ctx->scratch->int1 = wif->ampdu; in op_wlan_iface_config()
615 ctx->scratch->int1 = wif->ampdu_density; in op_wlan_iface_config()
618 ctx->scratch->int1 = wif->ampdu_limit; in op_wlan_iface_config()
621 ctx->scratch->int1 = wif->amsdu; in op_wlan_iface_config()
624 ctx->scratch->int1 = wif->amsdu_limit; in op_wlan_iface_config()
627 ctx->scratch->int1 = wif->ht_enabled; in op_wlan_iface_config()
630 ctx->scratch->int1 = wif->ht_compatible; in op_wlan_iface_config()
633 ctx->scratch->int1 = wif->ht_prot_mode; in op_wlan_iface_config()
636 ctx->scratch->int1 = wif->rifs; in op_wlan_iface_config()
639 ctx->scratch->int1 = wif->short_gi; in op_wlan_iface_config()
642 ctx->scratch->int1 = wif->smps_mode; in op_wlan_iface_config()
645 ctx->scratch->int1 = wif->tdma_slot; in op_wlan_iface_config()
648 ctx->scratch->int1 = wif->tdma_slot_count; in op_wlan_iface_config()
651 ctx->scratch->int1 = wif->tdma_slot_length; in op_wlan_iface_config()
654 ctx->scratch->int1 = wif->tdma_binterval; in op_wlan_iface_config()
660 if (val->syntax != SNMP_SYNTAX_OCTETSTRING) in op_wlan_iface_config()
663 ctx->scratch->int1 = val->v.octetstring.len; in op_wlan_iface_config()
664 ctx->scratch->ptr1 = malloc(val->v.octetstring.len + 1); in op_wlan_iface_config()
665 if (ctx->scratch->ptr1 == NULL) in op_wlan_iface_config()
667 if (val->var.subs[sub - 1] == LEAF_wlanIfaceDesiredSsid) in op_wlan_iface_config()
668 strlcpy(ctx->scratch->ptr1, val->v.octetstring.octets, in op_wlan_iface_config()
669 val->v.octetstring.len + 1); in op_wlan_iface_config()
671 memcpy(ctx->scratch->ptr1, val->v.octetstring.octets, in op_wlan_iface_config()
672 val->v.octetstring.len); in op_wlan_iface_config()
673 strval = val->v.octetstring.octets; in op_wlan_iface_config()
674 vlen = val->v.octetstring.len; in op_wlan_iface_config()
678 intval = ctx->scratch->int1; in op_wlan_iface_config()
682 if ((wif = wlan_get_interface(&val->var, sub)) == NULL) in op_wlan_iface_config()
684 switch (val->var.subs[sub - 1]) { in op_wlan_iface_config()
688 strval = ctx->scratch->ptr1; in op_wlan_iface_config()
689 vlen = ctx->scratch->int1; in op_wlan_iface_config()
697 switch (val->var.subs[sub - 1]) { in op_wlan_iface_config()
701 free(ctx->scratch->ptr1); in op_wlan_iface_config()
711 if (wlan_config_get_ioctl(wif, val->var.subs[sub - 1]) < 0) in op_wlan_iface_config()
714 switch (val->var.subs[sub - 1]) { in op_wlan_iface_config()
716 val->v.integer = wif->packet_burst; in op_wlan_iface_config()
719 return (string_get(val, wif->country_code, in op_wlan_iface_config()
722 val->v.integer = wif->reg_domain; in op_wlan_iface_config()
725 return (string_get(val, wif->desired_ssid, -1)); in op_wlan_iface_config()
727 val->v.integer = wif->desired_channel; in op_wlan_iface_config()
730 val->v.integer = wif->dyn_frequency; in op_wlan_iface_config()
733 val->v.integer = wif->fast_frames; in op_wlan_iface_config()
736 val->v.integer = wif->dturbo; in op_wlan_iface_config()
739 val->v.integer = wif->tx_power; in op_wlan_iface_config()
742 val->v.integer = wif->frag_threshold; in op_wlan_iface_config()
745 val->v.integer = wif->rts_threshold; in op_wlan_iface_config()
748 val->v.integer = wif->priv_subscribe; in op_wlan_iface_config()
751 val->v.integer = wif->bg_scan; in op_wlan_iface_config()
754 val->v.integer = wif->bg_scan_idle; in op_wlan_iface_config()
757 val->v.integer = wif->bg_scan_interval; in op_wlan_iface_config()
760 val->v.integer = wif->beacons_missed; in op_wlan_iface_config()
763 return (string_get(val, wif->desired_bssid, in op_wlan_iface_config()
766 val->v.integer = wif->roam_mode; in op_wlan_iface_config()
769 val->v.integer = wif->dot11d; in op_wlan_iface_config()
772 val->v.integer = wif->dot11h; in op_wlan_iface_config()
775 val->v.integer = wif->dynamic_wds; in op_wlan_iface_config()
778 val->v.integer = wif->power_save; in op_wlan_iface_config()
781 val->v.integer = wif->ap_bridge; in op_wlan_iface_config()
784 val->v.integer = wif->beacon_interval; in op_wlan_iface_config()
787 val->v.integer = wif->dtim_period; in op_wlan_iface_config()
790 val->v.integer = wif->hide_ssid; in op_wlan_iface_config()
793 val->v.integer = wif->inact_process; in op_wlan_iface_config()
796 val->v.integer = wif->do11g_protect; in op_wlan_iface_config()
799 val->v.integer = wif->dot11g_pure; in op_wlan_iface_config()
802 val->v.integer = wif->dot11n_pure; in op_wlan_iface_config()
805 val->v.integer = wif->ampdu; in op_wlan_iface_config()
808 val->v.integer = wif->ampdu_density; in op_wlan_iface_config()
811 val->v.integer = wif->ampdu_limit; in op_wlan_iface_config()
814 val->v.integer = wif->amsdu; in op_wlan_iface_config()
817 val->v.integer = wif->amsdu_limit; in op_wlan_iface_config()
820 val->v.integer = wif->ht_enabled; in op_wlan_iface_config()
823 val->v.integer = wif->ht_compatible; in op_wlan_iface_config()
826 val->v.integer = wif->ht_prot_mode; in op_wlan_iface_config()
829 val->v.integer = wif->rifs; in op_wlan_iface_config()
832 val->v.integer = wif->short_gi; in op_wlan_iface_config()
835 val->v.integer = wif->smps_mode; in op_wlan_iface_config()
838 val->v.integer = wif->tdma_slot; in op_wlan_iface_config()
841 val->v.integer = wif->tdma_slot_count; in op_wlan_iface_config()
844 val->v.integer = wif->tdma_slot_length; in op_wlan_iface_config()
847 val->v.integer = wif->tdma_binterval; in op_wlan_iface_config()
854 rc = wlan_config_set_ioctl(wif, val->var.subs[sub - 1], intval, in op_wlan_iface_config()
858 switch (val->var.subs[sub - 1]) { in op_wlan_iface_config()
862 free(ctx->scratch->ptr1); in op_wlan_iface_config()
876 op_wlan_if_peer(struct snmp_context *ctx, struct snmp_value *val, uint32_t sub, in op_wlan_if_peer() argument
887 if ((wip = wlan_get_peer(&val->var, sub, &wif)) == NULL) in op_wlan_if_peer()
891 if ((wip = wlan_get_next_peer(&val->var, sub, &wif)) == NULL) in op_wlan_if_peer()
893 wlan_append_mac_index(&val->var, sub, wif->wname, wip->pmac); in op_wlan_if_peer()
896 if ((wip = wlan_get_peer(&val->var, sub, &wif)) == NULL) in op_wlan_if_peer()
898 if (val->var.subs[sub - 1] != LEAF_wlanIfacePeerVlanTag) in op_wlan_if_peer()
900 ctx->scratch->int1 = wip->vlan; in op_wlan_if_peer()
901 if (wlan_peer_set_vlan(wif, wip, val->v.integer) < 0) in op_wlan_if_peer()
907 if ((wip = wlan_get_peer(&val->var, sub, &wif)) == NULL) in op_wlan_if_peer()
909 if (val->var.subs[sub - 1] != LEAF_wlanIfacePeerVlanTag) in op_wlan_if_peer()
911 if (wlan_peer_set_vlan(wif, wip, ctx->scratch->int1) < 0) in op_wlan_if_peer()
918 switch (val->var.subs[sub - 1]) { in op_wlan_if_peer()
920 return (string_get(val, wip->pmac, IEEE80211_ADDR_LEN)); in op_wlan_if_peer()
922 val->v.integer = wip->associd; in op_wlan_if_peer()
925 val->v.integer = wip->vlan; in op_wlan_if_peer()
928 val->v.integer = wip->frequency; in op_wlan_if_peer()
931 val->v.integer = wip->txrate; in op_wlan_if_peer()
934 val->v.integer = wip->rssi; in op_wlan_if_peer()
937 val->v.integer = wip->idle; in op_wlan_if_peer()
940 val->v.integer = wip->txseqs; in op_wlan_if_peer()
943 val->v.integer = wip->rxseqs; in op_wlan_if_peer()
946 val->v.integer = wip->txpower; in op_wlan_if_peer()
949 return (bits_get(val, (uint8_t *)&wip->capinfo, in op_wlan_if_peer()
950 sizeof(wip->capinfo))); in op_wlan_if_peer()
952 return (bits_get(val, (uint8_t *)&wip->state, in op_wlan_if_peer()
953 sizeof(wip->state))); in op_wlan_if_peer()
963 uint32_t sub, uint32_t iidx __unused, enum snmp_op op) in op_wlan_channels() argument
974 if ((channel = wlan_get_channel(&val->var, sub, &wif)) == NULL) in op_wlan_channels()
978 channel = wlan_get_next_channel(&val->var, sub, &wif); in op_wlan_channels()
981 wlan_append_channel_index(&val->var, sub, wif, channel); in op_wlan_channels()
993 switch (val->var.subs[sub - 1]) { in op_wlan_channels()
995 val->v.integer = channel->ic_ieee; in op_wlan_channels()
998 val->v.integer = wlan_get_channel_type(channel); in op_wlan_channels()
1001 bits = wlan_channel_flags_to_snmp(channel->ic_flags); in op_wlan_channels()
1004 val->v.integer = channel->ic_freq; in op_wlan_channels()
1007 val->v.integer = channel->ic_maxregpower; in op_wlan_channels()
1010 val->v.integer = channel->ic_maxpower; in op_wlan_channels()
1013 val->v.integer = channel->ic_minpower; in op_wlan_channels()
1016 bits = wlan_channel_state_to_snmp(channel->ic_state); in op_wlan_channels()
1019 val->v.integer = channel->ic_extieee; in op_wlan_channels()
1022 val->v.integer = channel->ic_maxantgain; in op_wlan_channels()
1031 uint32_t sub, uint32_t iidx __unused, enum snmp_op op) in op_wlan_roam_params() argument
1042 rparam = wlan_get_roam_param(&val->var, sub, &wif); in op_wlan_roam_params()
1047 rparam = wlan_get_next_roam_param(&val->var, sub, &wif, &phy); in op_wlan_roam_params()
1050 wlan_append_phy_index(&val->var, sub, wif->wname, phy); in op_wlan_roam_params()
1062 switch (val->var.subs[sub - 1]) { in op_wlan_roam_params()
1064 val->v.integer = rparam->rssi/2; in op_wlan_roam_params()
1067 val->v.integer = rparam->rate/2; in op_wlan_roam_params()
1078 uint32_t sub, uint32_t iidx __unused, enum snmp_op op) in op_wlan_tx_params() argument
1089 txparam = wlan_get_tx_param(&val->var, sub, &wif, &phy); in op_wlan_tx_params()
1095 txparam = wlan_get_next_tx_param(&val->var, sub, &wif, &phy); in op_wlan_tx_params()
1098 wlan_append_phy_index(&val->var, sub, wif->wname, phy); in op_wlan_tx_params()
1102 txparam = wlan_get_tx_param(&val->var, sub, &wif, &phy); in op_wlan_tx_params()
1105 switch (val->var.subs[sub - 1]) { in op_wlan_tx_params()
1107 ctx->scratch->int1 = txparam->ucastrate; in op_wlan_tx_params()
1108 txparam->ucastrate = val->v.integer * 2; in op_wlan_tx_params()
1111 ctx->scratch->int1 = txparam->mcastrate; in op_wlan_tx_params()
1112 txparam->mcastrate = val->v.integer * 2; in op_wlan_tx_params()
1115 ctx->scratch->int1 = txparam->mgmtrate; in op_wlan_tx_params()
1116 txparam->mgmtrate = val->v.integer * 2; in op_wlan_tx_params()
1119 ctx->scratch->int1 = txparam->maxretry; in op_wlan_tx_params()
1120 txparam->maxretry = val->v.integer; in op_wlan_tx_params()
1133 txparam = wlan_get_tx_param(&val->var, sub, &wif, &phy); in op_wlan_tx_params()
1136 switch (val->var.subs[sub - 1]) { in op_wlan_tx_params()
1138 txparam->ucastrate = ctx->scratch->int1; in op_wlan_tx_params()
1141 txparam->mcastrate = ctx->scratch->int1; in op_wlan_tx_params()
1144 txparam->mgmtrate = ctx->scratch->int1; in op_wlan_tx_params()
1147 txparam->maxretry = ctx->scratch->int1; in op_wlan_tx_params()
1160 switch (val->var.subs[sub - 1]) { in op_wlan_tx_params()
1162 val->v.integer = txparam->ucastrate / 2; in op_wlan_tx_params()
1165 val->v.integer = txparam->mcastrate / 2; in op_wlan_tx_params()
1168 val->v.integer = txparam->mgmtrate / 2; in op_wlan_tx_params()
1171 val->v.integer = txparam->maxretry; in op_wlan_tx_params()
1182 uint32_t sub, uint32_t iidx __unused, enum snmp_op op) in op_wlan_scan_config() argument
1190 if ((wif = wlan_get_interface(&val->var, sub)) == NULL) in op_wlan_scan_config()
1195 if ((wif = wlan_get_next_interface(&val->var, sub)) == NULL) in op_wlan_scan_config()
1197 wlan_append_ifindex(&val->var, sub, wif); in op_wlan_scan_config()
1201 if ((wif = wlan_get_interface(&val->var, sub)) == NULL) in op_wlan_scan_config()
1203 if (wif->scan_status == wlanScanConfigStatus_running in op_wlan_scan_config()
1204 && val->var.subs[sub - 1] != LEAF_wlanScanConfigStatus) in op_wlan_scan_config()
1206 switch (val->var.subs[sub - 1]) { in op_wlan_scan_config()
1208 ctx->scratch->int1 = wif->scan_flags; in op_wlan_scan_config()
1209 wif->scan_flags = val->v.integer; in op_wlan_scan_config()
1212 ctx->scratch->int1 = wif->scan_duration; in op_wlan_scan_config()
1213 wif->scan_duration = val->v.integer; in op_wlan_scan_config()
1216 ctx->scratch->int1 = wif->scan_mindwell; in op_wlan_scan_config()
1217 wif->scan_mindwell = val->v.integer; in op_wlan_scan_config()
1220 ctx->scratch->int1 = wif->scan_maxdwell; in op_wlan_scan_config()
1221 wif->scan_maxdwell = val->v.integer; in op_wlan_scan_config()
1224 if (val->v.integer == wlanScanConfigStatus_running || in op_wlan_scan_config()
1225 val->v.integer == wlanScanConfigStatus_cancel) { in op_wlan_scan_config()
1226 ctx->scratch->int1 = wif->scan_status; in op_wlan_scan_config()
1227 wif->scan_status = val->v.integer; in op_wlan_scan_config()
1235 if ((wif = wlan_get_interface(&val->var, sub)) == NULL) in op_wlan_scan_config()
1237 if (val->var.subs[sub - 1] == LEAF_wlanScanConfigStatus) in op_wlan_scan_config()
1238 if (wif->scan_status == wlanScanConfigStatus_running) in op_wlan_scan_config()
1243 if ((wif = wlan_get_interface(&val->var, sub)) == NULL) in op_wlan_scan_config()
1245 switch (val->var.subs[sub - 1]) { in op_wlan_scan_config()
1247 wif->scan_flags = ctx->scratch->int1; in op_wlan_scan_config()
1250 wif->scan_duration = ctx->scratch->int1; in op_wlan_scan_config()
1253 wif->scan_mindwell = ctx->scratch->int1; in op_wlan_scan_config()
1256 wif->scan_maxdwell = ctx->scratch->int1; in op_wlan_scan_config()
1259 wif->scan_status = ctx->scratch->int1; in op_wlan_scan_config()
1267 switch (val->var.subs[sub - 1]) { in op_wlan_scan_config()
1269 val->v.integer = wif->scan_flags; in op_wlan_scan_config()
1272 val->v.integer = wif->scan_duration; in op_wlan_scan_config()
1275 val->v.integer = wif->scan_mindwell; in op_wlan_scan_config()
1278 val->v.integer = wif->scan_maxdwell; in op_wlan_scan_config()
1281 val->v.integer = wif->scan_status; in op_wlan_scan_config()
1290 uint32_t sub, uint32_t iidx __unused, enum snmp_op op) in op_wlan_scan_results() argument
1300 if ((sr = wlan_get_scanr(&val->var, sub, &wif)) == NULL) in op_wlan_scan_results()
1305 if ((sr = wlan_get_next_scanr(&val->var, sub, &wif)) == NULL) in op_wlan_scan_results()
1307 wlan_append_scanr_index(&val->var, sub, wif->wname, sr->ssid, in op_wlan_scan_results()
1308 sr->bssid); in op_wlan_scan_results()
1321 switch (val->var.subs[sub - 1]) { in op_wlan_scan_results()
1323 return (string_get(val, sr->ssid, -1)); in op_wlan_scan_results()
1325 return (string_get(val, sr->bssid, IEEE80211_ADDR_LEN)); in op_wlan_scan_results()
1327 val->v.integer = sr->opchannel; /* XXX */ in op_wlan_scan_results()
1330 val->v.integer = sr->rssi; in op_wlan_scan_results()
1333 val->v.integer = sr->noise; in op_wlan_scan_results()
1336 val->v.integer = sr->bintval; in op_wlan_scan_results()
1339 return (bits_get(val, &sr->capinfo, sizeof(sr->capinfo))); in op_wlan_scan_results()
1349 uint32_t sub, uint32_t iidx __unused, enum snmp_op op) in op_wlan_iface_stats() argument
1357 if ((wif = wlan_get_interface(&val->var, sub)) == NULL) in op_wlan_iface_stats()
1361 if ((wif = wlan_get_next_interface(&val->var, sub)) == NULL) in op_wlan_iface_stats()
1363 wlan_append_ifindex(&val->var, sub, wif); in op_wlan_iface_stats()
1379 switch (val->var.subs[sub - 1]) { in op_wlan_iface_stats()
1381 val->v.uint32 = wif->stats.is_rx_badversion; in op_wlan_iface_stats()
1384 val->v.uint32 = wif->stats.is_rx_tooshort; in op_wlan_iface_stats()
1387 val->v.uint32 = wif->stats.is_rx_wrongbss; in op_wlan_iface_stats()
1390 val->v.uint32 = wif->stats.is_rx_dup; in op_wlan_iface_stats()
1393 val->v.uint32 = wif->stats.is_rx_wrongdir; in op_wlan_iface_stats()
1396 val->v.uint32 = wif->stats.is_rx_mcastecho; in op_wlan_iface_stats()
1399 val->v.uint32 = wif->stats.is_rx_notassoc; in op_wlan_iface_stats()
1402 val->v.uint32 = wif->stats.is_rx_noprivacy; in op_wlan_iface_stats()
1405 val->v.uint32 = wif->stats.is_rx_unencrypted; in op_wlan_iface_stats()
1408 val->v.uint32 = wif->stats.is_rx_wepfail; in op_wlan_iface_stats()
1411 val->v.uint32 = wif->stats.is_rx_decap; in op_wlan_iface_stats()
1414 val->v.uint32 = wif->stats.is_rx_mgtdiscard; in op_wlan_iface_stats()
1417 val->v.uint32 = wif->stats.is_rx_ctl; in op_wlan_iface_stats()
1420 val->v.uint32 = wif->stats.is_rx_beacon; in op_wlan_iface_stats()
1423 val->v.uint32 = wif->stats.is_rx_rstoobig; in op_wlan_iface_stats()
1426 val->v.uint32 = wif->stats.is_rx_elem_missing; in op_wlan_iface_stats()
1429 val->v.uint32 = wif->stats.is_rx_elem_toobig; in op_wlan_iface_stats()
1432 val->v.uint32 = wif->stats.is_rx_elem_toosmall; in op_wlan_iface_stats()
1435 val->v.uint32 = wif->stats.is_rx_elem_unknown; in op_wlan_iface_stats()
1438 val->v.uint32 = wif->stats.is_rx_chanmismatch; in op_wlan_iface_stats()
1441 val->v.uint32 = wif->stats.is_rx_nodealloc; in op_wlan_iface_stats()
1444 val->v.uint32 = wif->stats.is_rx_ssidmismatch; in op_wlan_iface_stats()
1447 val->v.uint32 = wif->stats.is_rx_auth_unsupported; in op_wlan_iface_stats()
1450 val->v.uint32 = wif->stats.is_rx_auth_fail; in op_wlan_iface_stats()
1453 val->v.uint32 = wif->stats.is_rx_auth_countermeasures; in op_wlan_iface_stats()
1456 val->v.uint32 = wif->stats.is_rx_assoc_bss; in op_wlan_iface_stats()
1459 val->v.uint32 = wif->stats.is_rx_assoc_notauth; in op_wlan_iface_stats()
1462 val->v.uint32 = wif->stats.is_rx_assoc_capmismatch; in op_wlan_iface_stats()
1465 val->v.uint32 = wif->stats.is_rx_assoc_norate; in op_wlan_iface_stats()
1468 val->v.uint32 = wif->stats.is_rx_assoc_badwpaie; in op_wlan_iface_stats()
1471 val->v.uint32 = wif->stats.is_rx_deauth; in op_wlan_iface_stats()
1474 val->v.uint32 = wif->stats.is_rx_disassoc; in op_wlan_iface_stats()
1477 val->v.uint32 = wif->stats.is_rx_badsubtype; in op_wlan_iface_stats()
1480 val->v.uint32 = wif->stats.is_rx_nobuf; in op_wlan_iface_stats()
1483 val->v.uint32 = wif->stats.is_rx_bad_auth; in op_wlan_iface_stats()
1486 val->v.uint32 = wif->stats.is_rx_unauth; in op_wlan_iface_stats()
1489 val->v.uint32 = wif->stats.is_rx_badkeyid; in op_wlan_iface_stats()
1492 val->v.uint32 = wif->stats.is_rx_ccmpreplay; in op_wlan_iface_stats()
1495 val->v.uint32 = wif->stats.is_rx_ccmpformat; in op_wlan_iface_stats()
1498 val->v.uint32 = wif->stats.is_rx_ccmpmic; in op_wlan_iface_stats()
1501 val->v.uint32 = wif->stats.is_rx_tkipreplay; in op_wlan_iface_stats()
1504 val->v.uint32 = wif->stats.is_rx_tkipformat; in op_wlan_iface_stats()
1507 val->v.uint32 = wif->stats.is_rx_tkipmic; in op_wlan_iface_stats()
1510 val->v.uint32 = wif->stats.is_rx_tkipicv; in op_wlan_iface_stats()
1513 val->v.uint32 = wif->stats.is_rx_acl; in op_wlan_iface_stats()
1516 val->v.uint32 = wif->stats.is_tx_nobuf; in op_wlan_iface_stats()
1519 val->v.uint32 = wif->stats.is_tx_nonode; in op_wlan_iface_stats()
1522 val->v.uint32 = wif->stats.is_tx_unknownmgt; in op_wlan_iface_stats()
1525 val->v.uint32 = wif->stats.is_tx_badcipher; in op_wlan_iface_stats()
1528 val->v.uint32 = wif->stats.is_tx_nodefkey; in op_wlan_iface_stats()
1531 val->v.uint32 = wif->stats.is_tx_fragframes; in op_wlan_iface_stats()
1534 val->v.uint32 = wif->stats.is_tx_frags; in op_wlan_iface_stats()
1537 val->v.uint32 = wif->stats.is_scan_active; in op_wlan_iface_stats()
1540 val->v.uint32 = wif->stats.is_scan_passive; in op_wlan_iface_stats()
1543 val->v.uint32 = wif->stats.is_node_timeout; in op_wlan_iface_stats()
1546 val->v.uint32 = wif->stats.is_crypto_nomem; in op_wlan_iface_stats()
1549 val->v.uint32 = wif->stats.is_crypto_tkip; in op_wlan_iface_stats()
1552 val->v.uint32 = wif->stats.is_crypto_tkipenmic; in op_wlan_iface_stats()
1555 val->v.uint32 = wif->stats.is_crypto_tkipdemic; in op_wlan_iface_stats()
1558 val->v.uint32 = wif->stats.is_crypto_tkipcm; in op_wlan_iface_stats()
1561 val->v.uint32 = wif->stats.is_crypto_ccmp; in op_wlan_iface_stats()
1564 val->v.uint32 = wif->stats.is_crypto_wep; in op_wlan_iface_stats()
1567 val->v.uint32 = wif->stats.is_crypto_setkey_cipher; in op_wlan_iface_stats()
1570 val->v.uint32 = wif->stats.is_crypto_setkey_nokey; in op_wlan_iface_stats()
1573 val->v.uint32 = wif->stats.is_crypto_delkey; in op_wlan_iface_stats()
1576 val->v.uint32 = wif->stats.is_crypto_badcipher; in op_wlan_iface_stats()
1579 val->v.uint32 = wif->stats.is_crypto_attachfail; in op_wlan_iface_stats()
1582 val->v.uint32 = wif->stats.is_crypto_keyfail; in op_wlan_iface_stats()
1585 val->v.uint32 = wif->stats.is_crypto_enmicfail; in op_wlan_iface_stats()
1588 val->v.uint32 = wif->stats.is_ibss_capmismatch; in op_wlan_iface_stats()
1591 val->v.uint32 = wif->stats.is_ps_unassoc; in op_wlan_iface_stats()
1594 val->v.uint32 = wif->stats.is_ps_badaid; in op_wlan_iface_stats()
1597 val->v.uint32 = wif->stats.is_ps_qempty; in op_wlan_iface_stats()
1600 val->v.uint32 = wif->stats.is_ff_badhdr; in op_wlan_iface_stats()
1603 val->v.uint32 = wif->stats.is_ff_tooshort; in op_wlan_iface_stats()
1606 val->v.uint32 = wif->stats.is_ff_split; in op_wlan_iface_stats()
1609 val->v.uint32 = wif->stats.is_ff_decap; in op_wlan_iface_stats()
1612 val->v.uint32 = wif->stats.is_ff_encap; in op_wlan_iface_stats()
1615 val->v.uint32 = wif->stats.is_rx_badbintval; in op_wlan_iface_stats()
1618 val->v.uint32 = wif->stats.is_rx_demicfail; in op_wlan_iface_stats()
1621 val->v.uint32 = wif->stats.is_rx_defrag; in op_wlan_iface_stats()
1624 val->v.uint32 = wif->stats.is_rx_mgmt; in op_wlan_iface_stats()
1627 val->v.uint32 = wif->stats.is_rx_action; in op_wlan_iface_stats()
1630 val->v.uint32 = wif->stats.is_amsdu_tooshort; in op_wlan_iface_stats()
1633 val->v.uint32 = wif->stats.is_amsdu_split; in op_wlan_iface_stats()
1636 val->v.uint32 = wif->stats.is_amsdu_decap; in op_wlan_iface_stats()
1639 val->v.uint32 = wif->stats.is_amsdu_encap; in op_wlan_iface_stats()
1642 val->v.uint32 = wif->stats.is_ampdu_bar_bad; in op_wlan_iface_stats()
1645 val->v.uint32 = wif->stats.is_ampdu_bar_oow; in op_wlan_iface_stats()
1648 val->v.uint32 = wif->stats.is_ampdu_bar_move; in op_wlan_iface_stats()
1651 val->v.uint32 = wif->stats.is_ampdu_bar_rx; in op_wlan_iface_stats()
1654 val->v.uint32 = wif->stats.is_ampdu_rx_oor; in op_wlan_iface_stats()
1657 val->v.uint32 = wif->stats.is_ampdu_rx_copy; in op_wlan_iface_stats()
1660 val->v.uint32 = wif->stats.is_ampdu_rx_drop; in op_wlan_iface_stats()
1663 val->v.uint32 = wif->stats.is_tx_badstate; in op_wlan_iface_stats()
1666 val->v.uint32 = wif->stats.is_tx_notassoc; in op_wlan_iface_stats()
1669 val->v.uint32 = wif->stats.is_tx_classify; in op_wlan_iface_stats()
1672 val->v.uint32 = wif->stats.is_dwds_mcast; in op_wlan_iface_stats()
1675 val->v.uint32 = wif->stats.is_ht_assoc_nohtcap; in op_wlan_iface_stats()
1678 val->v.uint32 = wif->stats.is_ht_assoc_downgrade; in op_wlan_iface_stats()
1681 val->v.uint32 = wif->stats.is_ht_assoc_norate; in op_wlan_iface_stats()
1684 val->v.uint32 = wif->stats.is_ampdu_rx_age; in op_wlan_iface_stats()
1687 val->v.uint32 = wif->stats.is_ampdu_rx_move; in op_wlan_iface_stats()
1690 val->v.uint32 = wif->stats.is_addba_reject; in op_wlan_iface_stats()
1693 val->v.uint32 = wif->stats.is_addba_norequest; in op_wlan_iface_stats()
1696 val->v.uint32 = wif->stats.is_addba_badtoken; in op_wlan_iface_stats()
1699 val->v.uint32 = wif->stats.is_addba_badpolicy; in op_wlan_iface_stats()
1702 val->v.uint32 = wif->stats.is_ampdu_stop; in op_wlan_iface_stats()
1705 val->v.uint32 = wif->stats.is_ampdu_stop_failed; in op_wlan_iface_stats()
1708 val->v.uint32 = wif->stats.is_ampdu_rx_reorder; in op_wlan_iface_stats()
1711 val->v.uint32 = wif->stats.is_scan_bg; in op_wlan_iface_stats()
1714 val->v.uint32 = wif->stats.is_rx_deauth_code; in op_wlan_iface_stats()
1717 val->v.uint32 = wif->stats.is_rx_disassoc_code; in op_wlan_iface_stats()
1720 val->v.uint32 = wif->stats.is_rx_authfail_code; in op_wlan_iface_stats()
1723 val->v.uint32 = wif->stats.is_beacon_miss; in op_wlan_iface_stats()
1726 val->v.uint32 = wif->stats.is_rx_badstate; in op_wlan_iface_stats()
1729 val->v.uint32 = wif->stats.is_ff_flush; in op_wlan_iface_stats()
1732 val->v.uint32 = wif->stats.is_tx_ctl; in op_wlan_iface_stats()
1735 val->v.uint32 = wif->stats.is_ampdu_rexmt; in op_wlan_iface_stats()
1738 val->v.uint32 = wif->stats.is_ampdu_rexmt_fail; in op_wlan_iface_stats()
1741 val->v.uint32 = wlanStatsReset_no_op; in op_wlan_iface_stats()
1752 uint32_t sub, uint32_t iidx __unused, enum snmp_op op) in op_wlan_wep_iface() argument
1760 if ((wif = wlan_get_interface(&val->var, sub)) == NULL || in op_wlan_wep_iface()
1761 !wif->wepsupported) in op_wlan_wep_iface()
1766 /* XXX: filter wif->wepsupported */ in op_wlan_wep_iface()
1767 if ((wif = wlan_get_next_interface(&val->var, sub)) == NULL) in op_wlan_wep_iface()
1769 wlan_append_ifindex(&val->var, sub, wif); in op_wlan_wep_iface()
1773 if ((wif = wlan_get_interface(&val->var, sub)) == NULL || in op_wlan_wep_iface()
1774 !wif->wepsupported) in op_wlan_wep_iface()
1776 switch (val->var.subs[sub - 1]) { in op_wlan_wep_iface()
1778 if (val->v.integer < wlanWepMode_off || in op_wlan_wep_iface()
1779 val->v.integer > wlanWepMode_mixed) in op_wlan_wep_iface()
1781 ctx->scratch->int1 = wif->wepmode; in op_wlan_wep_iface()
1782 wif->wepmode = val->v.integer; in op_wlan_wep_iface()
1784 wif->wepmode = ctx->scratch->int1; in op_wlan_wep_iface()
1789 if (val->v.integer < 0 || in op_wlan_wep_iface()
1790 val->v.integer > IEEE80211_WEP_NKID) in op_wlan_wep_iface()
1792 ctx->scratch->int1 = wif->weptxkey; in op_wlan_wep_iface()
1793 wif->weptxkey = val->v.integer; in op_wlan_wep_iface()
1795 wif->weptxkey = ctx->scratch->int1; in op_wlan_wep_iface()
1808 if ((wif = wlan_get_interface(&val->var, sub)) == NULL) in op_wlan_wep_iface()
1810 switch (val->var.subs[sub - 1]) { in op_wlan_wep_iface()
1812 wif->wepmode = ctx->scratch->int1; in op_wlan_wep_iface()
1817 wif->weptxkey = ctx->scratch->int1; in op_wlan_wep_iface()
1830 switch (val->var.subs[sub - 1]) { in op_wlan_wep_iface()
1834 val->v.integer = wif->wepmode; in op_wlan_wep_iface()
1839 val->v.integer = wif->weptxkey; in op_wlan_wep_iface()
1850 struct snmp_value *val __unused, uint32_t sub __unused, in op_wlan_wep_key()
1858 uint32_t sub, uint32_t iidx __unused, enum snmp_op op) in op_wlan_mac_access_control() argument
1866 if ((wif = wlan_get_interface(&val->var, sub)) == NULL || in op_wlan_mac_access_control()
1867 !wif->macsupported) in op_wlan_mac_access_control()
1872 /* XXX: filter wif->macsupported */ in op_wlan_mac_access_control()
1873 if ((wif = wlan_get_next_interface(&val->var, sub)) == NULL) in op_wlan_mac_access_control()
1875 wlan_append_ifindex(&val->var, sub, wif); in op_wlan_mac_access_control()
1879 if ((wif = wlan_get_interface(&val->var, sub)) == NULL || in op_wlan_mac_access_control()
1880 !wif->macsupported) in op_wlan_mac_access_control()
1882 switch (val->var.subs[sub - 1]) { in op_wlan_mac_access_control()
1884 ctx->scratch->int1 = wif->mac_policy; in op_wlan_mac_access_control()
1885 wif->mac_policy = val->v.integer; in op_wlan_mac_access_control()
1897 if ((wif = wlan_get_interface(&val->var, sub)) == NULL) in op_wlan_mac_access_control()
1899 switch (val->var.subs[sub - 1]) { in op_wlan_mac_access_control()
1902 wif->mac_policy = ctx->scratch->int1; in op_wlan_mac_access_control()
1916 if ((wif = wlan_get_interface(&val->var, sub)) == NULL) in op_wlan_mac_access_control()
1918 if (val->var.subs[sub - 1] == LEAF_wlanMACAccessControlPolicy) in op_wlan_mac_access_control()
1919 wif->mac_policy = ctx->scratch->int1; in op_wlan_mac_access_control()
1929 switch (val->var.subs[sub - 1]) { in op_wlan_mac_access_control()
1931 val->v.integer = wif->mac_policy; in op_wlan_mac_access_control()
1934 val->v.integer = wif->mac_nacls; in op_wlan_mac_access_control()
1937 val->v.integer = wlanMACAccessControlFlush_no_op; in op_wlan_mac_access_control()
1948 uint32_t sub, uint32_t iidx __unused, enum snmp_op op) in op_wlan_mac_acl_mac() argument
1958 if ((macl = wlan_get_acl_mac(&val->var, sub, &wif)) == NULL) in op_wlan_mac_acl_mac()
1963 if ((macl = wlan_get_next_acl_mac(&val->var, sub, &wif)) in op_wlan_mac_acl_mac()
1966 wlan_append_mac_index(&val->var, sub, wif->wname, macl->mac); in op_wlan_mac_acl_mac()
1970 switch (val->var.subs[sub - 1]) { in op_wlan_mac_acl_mac()
1974 return(wlan_acl_mac_set_status(ctx, val, sub)); in op_wlan_mac_acl_mac()
1980 if ((macl = wlan_get_acl_mac(&val->var, sub, &wif)) == NULL) in op_wlan_mac_acl_mac()
1982 if (val->v.integer == RowStatus_destroy && in op_wlan_mac_acl_mac()
1988 if ((macl = wlan_get_acl_mac(&val->var, sub, &wif)) == NULL) in op_wlan_mac_acl_mac()
1990 if (ctx->scratch->int1 == RowStatus_destroy && in op_wlan_mac_acl_mac()
1999 switch (val->var.subs[sub - 1]) { in op_wlan_mac_acl_mac()
2001 return (string_get(val, macl->mac, IEEE80211_ADDR_LEN)); in op_wlan_mac_acl_mac()
2003 val->v.integer = macl->mac_status; in op_wlan_mac_acl_mac()
2014 uint32_t sub, uint32_t iidx __unused, enum snmp_op op) in op_wlan_mesh_config() argument
2018 switch (val->var.subs[sub - 1]) { in op_wlan_mesh_config()
2045 switch (val->var.subs[sub - 1]) { in op_wlan_mesh_config()
2047 ctx->scratch->int1 = wlan_config.mesh_retryto; in op_wlan_mesh_config()
2048 wlan_config.mesh_retryto = val->v.integer; in op_wlan_mesh_config()
2051 ctx->scratch->int1 = wlan_config.mesh_holdingto; in op_wlan_mesh_config()
2052 wlan_config.mesh_holdingto = val->v.integer; in op_wlan_mesh_config()
2055 ctx->scratch->int1 = wlan_config.mesh_confirmto; in op_wlan_mesh_config()
2056 wlan_config.mesh_confirmto = val->v.integer; in op_wlan_mesh_config()
2059 ctx->scratch->int1 = wlan_config.mesh_maxretries; in op_wlan_mesh_config()
2060 wlan_config.mesh_maxretries = val->v.integer; in op_wlan_mesh_config()
2071 switch (val->var.subs[sub - 1]) { in op_wlan_mesh_config()
2073 wlan_config.mesh_retryto = ctx->scratch->int1; in op_wlan_mesh_config()
2076 wlan_config.mesh_confirmto = ctx->scratch->int1; in op_wlan_mesh_config()
2079 wlan_config.mesh_holdingto= ctx->scratch->int1; in op_wlan_mesh_config()
2082 wlan_config.mesh_maxretries = ctx->scratch->int1; in op_wlan_mesh_config()
2093 switch (val->var.subs[sub - 1]) { in op_wlan_mesh_config()
2095 val->v.integer = wlan_config.mesh_retryto; in op_wlan_mesh_config()
2098 val->v.integer = wlan_config.mesh_holdingto; in op_wlan_mesh_config()
2101 val->v.integer = wlan_config.mesh_confirmto; in op_wlan_mesh_config()
2104 val->v.integer = wlan_config.mesh_maxretries; in op_wlan_mesh_config()
2113 uint32_t sub, uint32_t iidx __unused, enum snmp_op op) in op_wlan_mesh_iface() argument
2122 if ((wif = wlan_mesh_get_iface(&val->var, sub)) == NULL) in op_wlan_mesh_iface()
2127 if ((wif = wlan_mesh_get_next_iface(&val->var, sub)) == NULL) in op_wlan_mesh_iface()
2129 wlan_append_ifindex(&val->var, sub, wif); in op_wlan_mesh_iface()
2133 if ((wif = wlan_mesh_get_iface(&val->var, sub)) == NULL) in op_wlan_mesh_iface()
2135 switch (val->var.subs[sub - 1]) { in op_wlan_mesh_iface()
2137 if (val->v.octetstring.len > IEEE80211_NWID_LEN) in op_wlan_mesh_iface()
2139 ctx->scratch->ptr1 = malloc(val->v.octetstring.len + 1); in op_wlan_mesh_iface()
2140 if (ctx->scratch->ptr1 == NULL) in op_wlan_mesh_iface()
2142 strlcpy(ctx->scratch->ptr1, wif->desired_ssid, in op_wlan_mesh_iface()
2143 val->v.octetstring.len + 1); in op_wlan_mesh_iface()
2144 ctx->scratch->int1 = strlen(wif->desired_ssid); in op_wlan_mesh_iface()
2145 memcpy(wif->desired_ssid, val->v.octetstring.octets, in op_wlan_mesh_iface()
2146 val->v.octetstring.len); in op_wlan_mesh_iface()
2147 wif->desired_ssid[val->v.octetstring.len] = '\0'; in op_wlan_mesh_iface()
2150 ctx->scratch->int1 = wif->mesh_ttl; in op_wlan_mesh_iface()
2151 wif->mesh_ttl = val->v.integer; in op_wlan_mesh_iface()
2154 ctx->scratch->int1 = wif->mesh_peering; in op_wlan_mesh_iface()
2155 wif->mesh_peering = val->v.integer; in op_wlan_mesh_iface()
2158 ctx->scratch->int1 = wif->mesh_forwarding; in op_wlan_mesh_iface()
2159 wif->mesh_forwarding = val->v.integer; in op_wlan_mesh_iface()
2162 ctx->scratch->int1 = wif->mesh_metric; in op_wlan_mesh_iface()
2163 wif->mesh_metric = val->v.integer; in op_wlan_mesh_iface()
2166 ctx->scratch->int1 = wif->mesh_path; in op_wlan_mesh_iface()
2167 wif->mesh_path = val->v.integer; in op_wlan_mesh_iface()
2170 if (val->v.integer != wlanMeshRoutesFlush_flush) in op_wlan_mesh_iface()
2176 if (val->var.subs[sub - 1] == LEAF_wlanMeshId) in op_wlan_mesh_iface()
2178 val->v.octetstring.octets, val->v.octetstring.len); in op_wlan_mesh_iface()
2180 rc = wlan_mesh_config_set(wif, val->var.subs[sub - 1]); in op_wlan_mesh_iface()
2186 if ((wif = wlan_mesh_get_iface(&val->var, sub)) == NULL) in op_wlan_mesh_iface()
2188 if (val->var.subs[sub - 1] == LEAF_wlanMeshRoutesFlush && in op_wlan_mesh_iface()
2191 if (val->var.subs[sub - 1] == LEAF_wlanMeshId) in op_wlan_mesh_iface()
2192 free(ctx->scratch->ptr1); in op_wlan_mesh_iface()
2196 if ((wif = wlan_mesh_get_iface(&val->var, sub)) == NULL) in op_wlan_mesh_iface()
2198 switch (val->var.subs[sub - 1]) { in op_wlan_mesh_iface()
2200 strlcpy(wif->desired_ssid, ctx->scratch->ptr1, in op_wlan_mesh_iface()
2202 free(ctx->scratch->ptr1); in op_wlan_mesh_iface()
2205 wif->mesh_ttl = ctx->scratch->int1; in op_wlan_mesh_iface()
2208 wif->mesh_peering = ctx->scratch->int1; in op_wlan_mesh_iface()
2211 wif->mesh_forwarding = ctx->scratch->int1; in op_wlan_mesh_iface()
2214 wif->mesh_metric = ctx->scratch->int1; in op_wlan_mesh_iface()
2217 wif->mesh_path = ctx->scratch->int1; in op_wlan_mesh_iface()
2224 if (val->var.subs[sub - 1] == LEAF_wlanMeshId) in op_wlan_mesh_iface()
2225 rc = wlan_config_set_dssid(wif, wif->desired_ssid, in op_wlan_mesh_iface()
2226 strlen(wif->desired_ssid)); in op_wlan_mesh_iface()
2228 rc = wlan_mesh_config_set(wif, val->var.subs[sub - 1]); in op_wlan_mesh_iface()
2237 if (val->var.subs[sub - 1] == LEAF_wlanMeshId) in op_wlan_mesh_iface()
2240 rc = wlan_mesh_config_get(wif, val->var.subs[sub - 1]); in op_wlan_mesh_iface()
2244 switch (val->var.subs[sub - 1]) { in op_wlan_mesh_iface()
2246 return (string_get(val, wif->desired_ssid, -1)); in op_wlan_mesh_iface()
2248 val->v.integer = wif->mesh_ttl; in op_wlan_mesh_iface()
2251 val->v.integer = wif->mesh_peering; in op_wlan_mesh_iface()
2254 val->v.integer = wif->mesh_forwarding; in op_wlan_mesh_iface()
2257 val->v.integer = wif->mesh_metric; in op_wlan_mesh_iface()
2260 val->v.integer = wif->mesh_path; in op_wlan_mesh_iface()
2263 val->v.integer = wlanMeshRoutesFlush_no_op; in op_wlan_mesh_iface()
2274 uint32_t sub, uint32_t iidx __unused, enum snmp_op op) in op_wlan_mesh_neighbor() argument
2284 if ((wip = wlan_mesh_get_peer(&val->var, sub, &wif)) == NULL) in op_wlan_mesh_neighbor()
2288 wip = wlan_mesh_get_next_peer(&val->var, sub, &wif); in op_wlan_mesh_neighbor()
2291 wlan_append_mac_index(&val->var, sub, wif->wname, in op_wlan_mesh_neighbor()
2292 wip->pmac); in op_wlan_mesh_neighbor()
2304 switch (val->var.subs[sub - 1]) { in op_wlan_mesh_neighbor()
2306 return (string_get(val, wip->pmac, IEEE80211_ADDR_LEN)); in op_wlan_mesh_neighbor()
2308 val->v.integer = wip->frequency; in op_wlan_mesh_neighbor()
2311 val->v.integer = wip->local_id; in op_wlan_mesh_neighbor()
2314 val->v.integer = wip->peer_id; in op_wlan_mesh_neighbor()
2317 return (bits_get(val, (uint8_t *)&wip->state, in op_wlan_mesh_neighbor()
2318 sizeof(wip->state))); in op_wlan_mesh_neighbor()
2320 val->v.integer = wip->txrate; in op_wlan_mesh_neighbor()
2323 val->v.integer = wip->rssi; in op_wlan_mesh_neighbor()
2326 val->v.integer = wip->idle; in op_wlan_mesh_neighbor()
2329 val->v.integer = wip->txseqs; in op_wlan_mesh_neighbor()
2332 val->v.integer = wip->rxseqs; in op_wlan_mesh_neighbor()
2343 uint32_t sub, uint32_t iidx __unused, enum snmp_op op) in op_wlan_mesh_route() argument
2353 if ((wmr = wlan_mesh_get_route(&val->var, sub, &wif)) == NULL) in op_wlan_mesh_route()
2358 wmr = wlan_mesh_get_next_route(&val->var, sub, &wif); in op_wlan_mesh_route()
2361 wlan_append_mac_index(&val->var, sub, wif->wname, in op_wlan_mesh_route()
2362 wmr->imroute.imr_dest); in op_wlan_mesh_route()
2366 switch (val->var.subs[sub - 1]) { in op_wlan_mesh_route()
2370 return(wlan_mesh_route_set_status(ctx, val, sub)); in op_wlan_mesh_route()
2377 if ((wmr = wlan_mesh_get_route(&val->var, sub, &wif)) == NULL) in op_wlan_mesh_route()
2379 if (val->v.integer == RowStatus_destroy && in op_wlan_mesh_route()
2385 if ((wmr = wlan_mesh_get_route(&val->var, sub, &wif)) == NULL) in op_wlan_mesh_route()
2387 if (ctx->scratch->int1 == RowStatus_destroy && in op_wlan_mesh_route()
2396 switch (val->var.subs[sub - 1]) { in op_wlan_mesh_route()
2398 return (string_get(val, wmr->imroute.imr_dest, in op_wlan_mesh_route()
2401 return (string_get(val, wmr->imroute.imr_nexthop, in op_wlan_mesh_route()
2404 val->v.integer = wmr->imroute.imr_nhops; in op_wlan_mesh_route()
2407 val->v.integer = wmr->imroute.imr_metric; in op_wlan_mesh_route()
2410 val->v.integer = wmr->imroute.imr_lifetime; in op_wlan_mesh_route()
2413 val->v.integer = wmr->imroute.imr_lastmseq; in op_wlan_mesh_route()
2416 val->v.integer = 0; in op_wlan_mesh_route()
2417 if ((wmr->imroute.imr_flags & in op_wlan_mesh_route()
2419 val->v.integer |= (0x1 << wlanMeshRouteFlags_valid); in op_wlan_mesh_route()
2420 if ((wmr->imroute.imr_flags & in op_wlan_mesh_route()
2422 val->v.integer |= (0x1 << wlanMeshRouteFlags_proxy); in op_wlan_mesh_route()
2423 return (bits_get(val, (uint8_t *)&val->v.integer, in op_wlan_mesh_route()
2424 sizeof(val->v.integer))); in op_wlan_mesh_route()
2426 val->v.integer = wmr->mroute_status; in op_wlan_mesh_route()
2435 uint32_t sub, uint32_t iidx __unused, enum snmp_op op) in op_wlan_mesh_stats() argument
2443 if ((wif = wlan_mesh_get_iface(&val->var, sub)) == NULL) in op_wlan_mesh_stats()
2447 if ((wif = wlan_mesh_get_next_iface(&val->var, sub)) == NULL) in op_wlan_mesh_stats()
2449 wlan_append_ifindex(&val->var, sub, wif); in op_wlan_mesh_stats()
2464 switch (val->var.subs[sub - 1]) { in op_wlan_mesh_stats()
2466 val->v.uint32 = wif->stats.is_mesh_wrongmesh; in op_wlan_mesh_stats()
2469 val->v.uint32 = wif->stats.is_mesh_nolink; in op_wlan_mesh_stats()
2472 val->v.uint32 = wif->stats.is_mesh_fwd_ttl; in op_wlan_mesh_stats()
2475 val->v.uint32 = wif->stats.is_mesh_fwd_nobuf; in op_wlan_mesh_stats()
2478 val->v.uint32 = wif->stats.is_mesh_fwd_tooshort; in op_wlan_mesh_stats()
2481 val->v.uint32 = wif->stats.is_mesh_fwd_disabled; in op_wlan_mesh_stats()
2484 val->v.uint32 = wif->stats.is_mesh_fwd_nopath; in op_wlan_mesh_stats()
2487 val->v.uint32 = wif->stats.is_mesh_badae; in op_wlan_mesh_stats()
2490 val->v.uint32 = wif->stats.is_mesh_rtaddfailed; in op_wlan_mesh_stats()
2493 val->v.uint32 = wif->stats.is_mesh_notproxy; in op_wlan_mesh_stats()
2496 val->v.uint32 = wif->stats.is_rx_badalign; in op_wlan_mesh_stats()
2507 uint32_t sub, uint32_t iidx __unused, enum snmp_op op) in op_wlan_hwmp_config() argument
2511 switch (val->var.subs[sub - 1]) { in op_wlan_hwmp_config()
2547 switch (val->var.subs[sub - 1]) { in op_wlan_hwmp_config()
2549 ctx->scratch->int1 = wlan_config.hwmp_inact; in op_wlan_hwmp_config()
2550 wlan_config.hwmp_inact = val->v.integer; in op_wlan_hwmp_config()
2553 ctx->scratch->int1 = wlan_config.hwmp_rannint; in op_wlan_hwmp_config()
2554 wlan_config.hwmp_rannint = val->v.integer; in op_wlan_hwmp_config()
2557 ctx->scratch->int1 = wlan_config.hwmp_rootint; in op_wlan_hwmp_config()
2558 wlan_config.hwmp_rootint = val->v.integer; in op_wlan_hwmp_config()
2561 ctx->scratch->int1 = wlan_config.hwmp_roottimeout; in op_wlan_hwmp_config()
2562 wlan_config.hwmp_roottimeout = val->v.integer; in op_wlan_hwmp_config()
2565 ctx->scratch->int1 = wlan_config.hwmp_pathlifetime; in op_wlan_hwmp_config()
2566 wlan_config.hwmp_pathlifetime = val->v.integer; in op_wlan_hwmp_config()
2569 ctx->scratch->int1 = wlan_config.hwmp_replyforward; in op_wlan_hwmp_config()
2570 wlan_config.hwmp_replyforward = val->v.integer; in op_wlan_hwmp_config()
2573 ctx->scratch->int1 = wlan_config.hwmp_targetonly; in op_wlan_hwmp_config()
2574 wlan_config.hwmp_targetonly = val->v.integer; in op_wlan_hwmp_config()
2585 switch (val->var.subs[sub - 1]) { in op_wlan_hwmp_config()
2587 wlan_config.hwmp_inact = ctx->scratch->int1; in op_wlan_hwmp_config()
2590 wlan_config.hwmp_rannint = ctx->scratch->int1; in op_wlan_hwmp_config()
2593 wlan_config.hwmp_rootint = ctx->scratch->int1; in op_wlan_hwmp_config()
2596 wlan_config.hwmp_roottimeout = ctx->scratch->int1; in op_wlan_hwmp_config()
2599 wlan_config.hwmp_pathlifetime = ctx->scratch->int1; in op_wlan_hwmp_config()
2602 wlan_config.hwmp_replyforward = ctx->scratch->int1; in op_wlan_hwmp_config()
2605 wlan_config.hwmp_targetonly = ctx->scratch->int1; in op_wlan_hwmp_config()
2616 switch (val->var.subs[sub - 1]) { in op_wlan_hwmp_config()
2618 val->v.integer = wlan_config.hwmp_inact; in op_wlan_hwmp_config()
2621 val->v.integer = wlan_config.hwmp_rannint; in op_wlan_hwmp_config()
2624 val->v.integer = wlan_config.hwmp_rootint; in op_wlan_hwmp_config()
2627 val->v.integer = wlan_config.hwmp_roottimeout; in op_wlan_hwmp_config()
2630 val->v.integer = wlan_config.hwmp_pathlifetime; in op_wlan_hwmp_config()
2633 val->v.integer = wlan_config.hwmp_replyforward; in op_wlan_hwmp_config()
2636 val->v.integer = wlan_config.hwmp_targetonly; in op_wlan_hwmp_config()
2645 uint32_t sub, uint32_t iidx __unused, enum snmp_op op) in op_wlan_hwmp_iface() argument
2653 if ((wif = wlan_mesh_get_iface(&val->var, sub)) == NULL) in op_wlan_hwmp_iface()
2658 if ((wif = wlan_mesh_get_next_iface(&val->var, sub)) == NULL) in op_wlan_hwmp_iface()
2660 wlan_append_ifindex(&val->var, sub, wif); in op_wlan_hwmp_iface()
2664 if ((wif = wlan_mesh_get_iface(&val->var, sub)) == NULL) in op_wlan_hwmp_iface()
2666 switch (val->var.subs[sub - 1]) { in op_wlan_hwmp_iface()
2668 ctx->scratch->int1 = wif->hwmp_root_mode; in op_wlan_hwmp_iface()
2669 wif->hwmp_root_mode = val->v.integer; in op_wlan_hwmp_iface()
2672 ctx->scratch->int1 = wif->hwmp_max_hops; in op_wlan_hwmp_iface()
2673 wif->hwmp_max_hops = val->v.integer; in op_wlan_hwmp_iface()
2678 if (wlan_hwmp_config_set(wif, val->var.subs[sub - 1]) < 0) in op_wlan_hwmp_iface()
2686 if ((wif = wlan_mesh_get_iface(&val->var, sub)) == NULL) in op_wlan_hwmp_iface()
2688 switch (val->var.subs[sub - 1]) { in op_wlan_hwmp_iface()
2690 wif->hwmp_root_mode = ctx->scratch->int1; in op_wlan_hwmp_iface()
2693 wif->hwmp_max_hops = ctx->scratch->int1; in op_wlan_hwmp_iface()
2698 if (wlan_hwmp_config_set(wif, val->var.subs[sub - 1]) < 0) in op_wlan_hwmp_iface()
2706 if (wlan_hwmp_config_get(wif, val->var.subs[sub - 1]) < 0) in op_wlan_hwmp_iface()
2709 switch (val->var.subs[sub - 1]) { in op_wlan_hwmp_iface()
2711 val->v.integer = wif->hwmp_root_mode; in op_wlan_hwmp_iface()
2714 val->v.integer = wif->hwmp_max_hops; in op_wlan_hwmp_iface()
2725 uint32_t sub, uint32_t iidx __unused, enum snmp_op op) in op_wlan_hwmp_stats() argument
2733 if ((wif = wlan_mesh_get_iface(&val->var, sub)) == NULL) in op_wlan_hwmp_stats()
2737 if ((wif = wlan_mesh_get_next_iface(&val->var, sub)) == NULL) in op_wlan_hwmp_stats()
2739 wlan_append_ifindex(&val->var, sub, wif); in op_wlan_hwmp_stats()
2754 switch (val->var.subs[sub - 1]) { in op_wlan_hwmp_stats()
2756 val->v.uint32 = wif->stats.is_hwmp_wrongseq; in op_wlan_hwmp_stats()
2759 val->v.uint32 = wif->stats.is_hwmp_rootreqs; in op_wlan_hwmp_stats()
2762 val->v.uint32 = wif->stats.is_hwmp_rootrann; in op_wlan_hwmp_stats()
2765 val->v.uint32 = wif->stats.is_hwmp_proxy; in op_wlan_hwmp_stats()
2775 * Encode BITS type for a response packet - XXX: this belongs to the snmp lib.
2783 value->v.octetstring.len = 0; in bits_get()
2784 value->v.octetstring.octets = NULL; in bits_get()
2788 /* Determine length - up to 8 octets supported so far. */ in bits_get()
2789 for (size = len; size > 0; size--) in bits_get()
2790 if (ptr[size - 1] != 0) in bits_get()
2795 value->v.octetstring.len = (u_long)size; in bits_get()
2796 if ((value->v.octetstring.octets = malloc((size_t)size)) == NULL) in bits_get()
2798 memcpy(value->v.octetstring.octets, ptr, (size_t)size); in bits_get()
2809 free(wif->chanlist); in wlan_free_interface()
2833 if (strcmp(wif->wname, wname) == 0) { in wlan_find_interface()
2834 if (wif->status != RowStatus_active) in wlan_find_interface()
2858 * Add a new interface to the list - sorted by name.
2867 strcmp(wif->wname, prev->wname) < 0) { in wlan_add_wif()
2873 if ((cmp = strcmp(wif->wname, temp->wname)) <= 0) in wlan_add_wif()
2883 syslog(LOG_ERR, "Wlan iface %s already in list", wif->wname); in wlan_add_wif()
2884 return (-1); in wlan_add_wif()
2898 if (strcmp(wname, wif->wname) == 0) { in wlan_new_wif()
2899 wif->internal = 0; in wlan_new_wif()
2907 strlcpy(wif->wname, wname, IFNAMSIZ); in wlan_new_wif()
2908 wif->status = RowStatus_notReady; in wlan_new_wif()
2909 wif->state = wlanIfaceState_down; in wlan_new_wif()
2910 wif->mode = WlanIfaceOperatingModeType_station; in wlan_new_wif()
2932 if (mif->mib.ifmd_data.ifi_type != IFT_ETHER || in wlan_attach_newif()
2933 wlan_check_media(mif->name) != IFM_IEEE80211) in wlan_attach_newif()
2936 if ((wif = wlan_new_wif(mif->name)) == NULL) in wlan_attach_newif()
2937 return (-1); in wlan_attach_newif()
2940 wif->index = mif->index; in wlan_attach_newif()
2941 wif->status = RowStatus_active; in wlan_attach_newif()
2957 wif->status = RowStatus_active; in wlan_iface_create()
2958 if (wif->state == wlanIfaceState_up) in wlan_iface_create()
2970 if (wif->internal == 0) in wlan_iface_destroy()
2991 * XXX: wlan_get_channel_list() not needed - in wlan_update_interface()
3004 if (wif->mode == WlanIfaceOperatingModeType_meshPoint) { in wlan_update_interface()
3020 if ((time(NULL) - wlan_iflist_age) <= WLAN_LIST_MAXAGE) in wlan_update_interface_list()
3028 if (wif->status == RowStatus_active && wlan_get_opmode(wif) < 0) in wlan_update_interface_list()
3035 wlan_append_ifindex(struct asn_oid *oid, uint sub, const struct wlan_iface *w) in wlan_append_ifindex() argument
3039 oid->len = sub + strlen(w->wname) + 1; in wlan_append_ifindex()
3040 oid->subs[sub] = strlen(w->wname); in wlan_append_ifindex()
3041 for (i = 1; i <= strlen(w->wname); i++) in wlan_append_ifindex()
3042 oid->subs[sub + i] = w->wname[i - 1]; in wlan_append_ifindex()
3046 wlan_get_ifname(const struct asn_oid *oid, uint sub, uint8_t *wname) in wlan_get_ifname() argument
3052 if (oid->len - sub != oid->subs[sub] + 1 || oid->subs[sub] >= IFNAMSIZ) in wlan_get_ifname()
3055 for (i = 0; i < oid->subs[sub]; i++) in wlan_get_ifname()
3056 wname[i] = oid->subs[sub + i + 1]; in wlan_get_ifname()
3063 wlan_get_interface(const struct asn_oid *oid, uint sub) in wlan_get_interface() argument
3067 if (wlan_get_ifname(oid, sub, wname) == NULL) in wlan_get_interface()
3074 wlan_get_next_interface(const struct asn_oid *oid, uint sub) in wlan_get_next_interface() argument
3080 if (oid->len - sub == 0) { in wlan_get_next_interface()
3083 if (wif->status == RowStatus_active) in wlan_get_next_interface()
3088 if (oid->len - sub != oid->subs[sub] + 1 || oid->subs[sub] >= IFNAMSIZ) in wlan_get_next_interface()
3092 for (i = 0; i < oid->subs[sub]; i++) in wlan_get_next_interface()
3093 wname[i] = oid->subs[sub + i + 1]; in wlan_get_next_interface()
3099 if (wif->status == RowStatus_active) in wlan_get_next_interface()
3106 wlan_get_snmp_interface(const struct asn_oid *oid, uint sub) in wlan_get_snmp_interface() argument
3111 if (wlan_get_ifname(oid, sub, wname) == NULL) in wlan_get_snmp_interface()
3116 if (strcmp(wif->wname, wname) == 0) in wlan_get_snmp_interface()
3123 wlan_get_next_snmp_interface(const struct asn_oid *oid, uint sub) in wlan_get_next_snmp_interface() argument
3129 if (oid->len - sub == 0) in wlan_get_next_snmp_interface()
3132 if (oid->len - sub != oid->subs[sub] + 1 || oid->subs[sub] >= IFNAMSIZ) in wlan_get_next_snmp_interface()
3136 for (i = 0; i < oid->subs[sub]; i++) in wlan_get_next_snmp_interface()
3137 wname[i] = oid->subs[sub + i + 1]; in wlan_get_next_snmp_interface()
3142 if (strcmp(wif->wname, wname) == 0) in wlan_get_next_snmp_interface()
3150 * name and a MAC address - ACL MACs and Mesh Routes.
3153 wlan_mac_index_decode(const struct asn_oid *oid, uint sub, in wlan_mac_index_decode() argument
3159 if (oid->len - sub != oid->subs[sub] + 2 + IEEE80211_ADDR_LEN in wlan_mac_index_decode()
3160 || oid->subs[sub] >= IFNAMSIZ) in wlan_mac_index_decode()
3161 return (-1); in wlan_mac_index_decode()
3163 for (i = 0; i < oid->subs[sub]; i++) in wlan_mac_index_decode()
3164 wname[i] = oid->subs[sub + i + 1]; in wlan_mac_index_decode()
3167 mac_off = sub + oid->subs[sub] + 1; in wlan_mac_index_decode()
3168 if (oid->subs[mac_off] != IEEE80211_ADDR_LEN) in wlan_mac_index_decode()
3169 return (-1); in wlan_mac_index_decode()
3171 mac[i] = oid->subs[mac_off + i + 1]; in wlan_mac_index_decode()
3177 wlan_append_mac_index(struct asn_oid *oid, uint sub, char *wname, uint8_t *mac) in wlan_append_mac_index() argument
3181 oid->len = sub + strlen(wname) + IEEE80211_ADDR_LEN + 2; in wlan_append_mac_index()
3182 oid->subs[sub] = strlen(wname); in wlan_append_mac_index()
3184 oid->subs[sub + i] = wname[i - 1]; in wlan_append_mac_index()
3186 sub += strlen(wname) + 1; in wlan_append_mac_index()
3187 oid->subs[sub] = IEEE80211_ADDR_LEN; in wlan_append_mac_index()
3189 oid->subs[sub + i] = mac[i - 1]; in wlan_append_mac_index()
3194 * name and the PHY mode - Roam and TX params.
3197 wlan_phy_index_decode(const struct asn_oid *oid, uint sub, char *wname, in wlan_phy_index_decode() argument
3202 if (oid->len - sub != oid->subs[sub] + 2 || oid->subs[sub] >= IFNAMSIZ) in wlan_phy_index_decode()
3203 return (-1); in wlan_phy_index_decode()
3205 for (i = 0; i < oid->subs[sub]; i++) in wlan_phy_index_decode()
3206 wname[i] = oid->subs[sub + i + 1]; in wlan_phy_index_decode()
3209 *phy = oid->subs[sub + oid->subs[sub] + 1]; in wlan_phy_index_decode()
3214 wlan_append_phy_index(struct asn_oid *oid, uint sub, char *wname, uint32_t phy) in wlan_append_phy_index() argument
3218 oid->len = sub + strlen(wname) + 2; in wlan_append_phy_index()
3219 oid->subs[sub] = strlen(wname); in wlan_append_phy_index()
3221 oid->subs[sub + i] = wname[i - 1]; in wlan_append_phy_index()
3222 oid->subs[sub + strlen(wname) + 1] = phy; in wlan_append_phy_index()
3233 while ((wip = SLIST_FIRST(&wif->peerlist)) != NULL) { in wlan_free_peerlist()
3234 SLIST_REMOVE_HEAD(&wif->peerlist, wp); in wlan_free_peerlist()
3238 SLIST_INIT(&wif->peerlist); in wlan_free_peerlist()
3246 SLIST_FOREACH(wip, &wif->peerlist, wp) in wlan_find_peer()
3247 if (memcmp(wip->pmac, peermac, IEEE80211_ADDR_LEN) == 0) in wlan_find_peer()
3262 memcpy(wip->pmac, pmac, IEEE80211_ADDR_LEN); in wlan_new_peer()
3278 SLIST_FOREACH(temp, &wif->peerlist, wp) in wlan_add_peer()
3279 if (memcmp(temp->pmac, wip->pmac, IEEE80211_ADDR_LEN) == 0) in wlan_add_peer()
3280 return (-1); in wlan_add_peer()
3282 if ((prev = SLIST_FIRST(&wif->peerlist)) == NULL || in wlan_add_peer()
3283 memcmp(wip->pmac, prev->pmac, IEEE80211_ADDR_LEN) < 0) { in wlan_add_peer()
3284 SLIST_INSERT_HEAD(&wif->peerlist, wip, wp); in wlan_add_peer()
3288 SLIST_FOREACH(temp, &wif->peerlist, wp) { in wlan_add_peer()
3289 if (memcmp(wip->pmac, temp->pmac, IEEE80211_ADDR_LEN) < 0) in wlan_add_peer()
3303 if ((time(NULL) - wlan_peerlist_age) <= WLAN_LIST_MAXAGE) in wlan_update_peers()
3308 if (wif->status != RowStatus_active) in wlan_update_peers()
3317 wlan_get_peer(const struct asn_oid *oid, uint sub, struct wlan_iface **wif) in wlan_get_peer() argument
3322 if (wlan_mac_index_decode(oid, sub, wname, pmac) < 0) in wlan_get_peer()
3332 wlan_get_next_peer(const struct asn_oid *oid, uint sub, struct wlan_iface **wif) in wlan_get_next_peer() argument
3338 if (oid->len - sub == 0) { in wlan_get_next_peer()
3341 if ((*wif)->mode == in wlan_get_next_peer()
3344 wip = SLIST_FIRST(&(*wif)->peerlist); in wlan_get_next_peer()
3351 if (wlan_mac_index_decode(oid, sub, wname, pmac) < 0 || in wlan_get_next_peer()
3360 if ((*wif)->mode == WlanIfaceOperatingModeType_meshPoint) in wlan_get_next_peer()
3362 if ((wip = SLIST_FIRST(&(*wif)->peerlist)) != NULL) in wlan_get_next_peer()
3377 if ((time(NULL) - wlan_chanlist_age) <= WLAN_LIST_MAXAGE) in wlan_update_channels()
3382 if (wif->status != RowStatus_active) in wlan_update_channels()
3390 wlan_channel_index_decode(const struct asn_oid *oid, uint sub, char *wname, in wlan_channel_index_decode() argument
3394 if (oid->len - sub != oid->subs[sub] + 2 || oid->subs[sub] >= IFNAMSIZ) in wlan_channel_index_decode()
3395 return (-1); in wlan_channel_index_decode()
3397 for (i = 0; i < oid->subs[sub]; i++) in wlan_channel_index_decode()
3398 wname[i] = oid->subs[sub + i + 1]; in wlan_channel_index_decode()
3401 *cindex = oid->subs[sub + oid->subs[sub] + 1]; in wlan_channel_index_decode()
3407 wlan_append_channel_index(struct asn_oid *oid, uint sub, in wlan_append_channel_index() argument
3412 oid->len = sub + strlen(wif->wname) + 2; in wlan_append_channel_index()
3413 oid->subs[sub] = strlen(wif->wname); in wlan_append_channel_index()
3414 for (i = 1; i <= strlen(wif->wname); i++) in wlan_append_channel_index()
3415 oid->subs[sub + i] = wif->wname[i - 1]; in wlan_append_channel_index()
3416 oid->subs[sub + strlen(wif->wname) + 1] = (channel - wif->chanlist) + 1; in wlan_append_channel_index()
3439 return (-1); in wlan_get_channel_type()
3445 if (wif->chanlist == NULL || cindex > wif->nchannels) in wlan_find_channel()
3448 return (wif->chanlist + cindex - 1); in wlan_find_channel()
3452 wlan_get_channel(const struct asn_oid *oid, uint sub, struct wlan_iface **wif) in wlan_get_channel() argument
3457 if (wlan_channel_index_decode(oid, sub, wname, &cindex) < 0) in wlan_get_channel()
3467 wlan_get_next_channel(const struct asn_oid *oid, uint sub, in wlan_get_next_channel() argument
3473 if (oid->len - sub == 0) { in wlan_get_next_channel()
3476 if ((*wif)->status != RowStatus_active) in wlan_get_next_channel()
3478 if ((*wif)->nchannels != 0 && (*wif)->chanlist != NULL) in wlan_get_next_channel()
3479 return ((*wif)->chanlist); in wlan_get_next_channel()
3484 if (wlan_channel_index_decode(oid, sub, wname, &cindex) < 0) in wlan_get_next_channel()
3490 if (cindex < (*wif)->nchannels) in wlan_get_next_channel()
3491 return ((*wif)->chanlist + cindex); in wlan_get_next_channel()
3494 if ((*wif)->status == RowStatus_active) in wlan_get_next_channel()
3495 if ((*wif)->nchannels != 0 && (*wif)->chanlist != NULL) in wlan_get_next_channel()
3496 return ((*wif)->chanlist); in wlan_get_next_channel()
3509 if ((time(NULL) - wlan_roamlist_age) <= WLAN_LIST_MAXAGE) in wlan_update_roam_params()
3514 if (wif->status != RowStatus_active) in wlan_update_roam_params()
3522 wlan_get_roam_param(const struct asn_oid *oid, uint sub, struct wlan_iface **wif) in wlan_get_roam_param() argument
3527 if (wlan_phy_index_decode(oid, sub, wname, &phy) < 0) in wlan_get_roam_param()
3536 return ((*wif)->roamparams.params + phy - 1); in wlan_get_roam_param()
3540 wlan_get_next_roam_param(const struct asn_oid *oid, uint sub, in wlan_get_next_roam_param() argument
3545 if (oid->len - sub == 0) { in wlan_get_next_roam_param()
3548 if ((*wif)->status != RowStatus_active) in wlan_get_next_roam_param()
3551 return ((*wif)->roamparams.params); in wlan_get_next_roam_param()
3556 if (wlan_phy_index_decode(oid, sub, wname, phy) < 0) in wlan_get_next_roam_param()
3563 return ((*wif)->roamparams.params + *phy - 1); in wlan_get_next_roam_param()
3567 if ((*wif)->status == RowStatus_active) in wlan_get_next_roam_param()
3568 return ((*wif)->roamparams.params); in wlan_get_next_roam_param()
3581 if ((time(NULL) - wlan_tx_paramlist_age) <= WLAN_LIST_MAXAGE) in wlan_update_tx_params()
3586 if (wif->status != RowStatus_active) in wlan_update_tx_params()
3595 wlan_get_tx_param(const struct asn_oid *oid, uint sub, struct wlan_iface **wif, in wlan_get_tx_param() argument
3600 if (wlan_phy_index_decode(oid, sub, wname, phy) < 0) in wlan_get_tx_param()
3609 return ((*wif)->txparams.params + *phy - 1); in wlan_get_tx_param()
3613 wlan_get_next_tx_param(const struct asn_oid *oid, uint sub, in wlan_get_next_tx_param() argument
3618 if (oid->len - sub == 0) { in wlan_get_next_tx_param()
3621 if ((*wif)->status != RowStatus_active) in wlan_get_next_tx_param()
3624 return ((*wif)->txparams.params); in wlan_get_next_tx_param()
3629 if (wlan_phy_index_decode(oid, sub, wname, phy) < 0) in wlan_get_next_tx_param()
3636 return ((*wif)->txparams.params + *phy - 1); in wlan_get_next_tx_param()
3640 if ((*wif)->status == RowStatus_active) in wlan_get_next_tx_param()
3641 return ((*wif)->txparams.params); in wlan_get_next_tx_param()
3654 while ((sr = SLIST_FIRST(&wif->scanlist)) != NULL) { in wlan_scan_free_results()
3655 SLIST_REMOVE_HEAD(&wif->scanlist, wsr); in wlan_scan_free_results()
3659 SLIST_INIT(&wif->scanlist); in wlan_scan_free_results()
3667 SLIST_FOREACH(sr, &wif->scanlist, wsr) in wlan_scan_find_result()
3668 if (strlen(ssid) == strlen(sr->ssid) && in wlan_scan_find_result()
3669 strcmp(sr->ssid, ssid) == 0 && in wlan_scan_find_result()
3670 memcmp(sr->bssid, bssid, IEEE80211_ADDR_LEN) == 0) in wlan_scan_find_result()
3687 strlcpy(sr->ssid, ssid, IEEE80211_NWID_LEN + 1); in wlan_scan_new_result()
3688 memcpy(sr->bssid, bssid, IEEE80211_ADDR_LEN); in wlan_scan_new_result()
3705 if (strlen(sr1->ssid) < strlen(sr2->ssid)) in wlan_scan_compare_result()
3706 return (-1); in wlan_scan_compare_result()
3707 if (strlen(sr1->ssid) > strlen(sr2->ssid)) in wlan_scan_compare_result()
3710 for (i = 0; i < strlen(sr1->ssid) && i < strlen(sr2->ssid); i++) { in wlan_scan_compare_result()
3711 if (sr1->ssid[i] < sr2->ssid[i]) in wlan_scan_compare_result()
3712 return (-1); in wlan_scan_compare_result()
3713 if (sr1->ssid[i] > sr2->ssid[i]) in wlan_scan_compare_result()
3718 if (sr1->bssid[i] < sr2->bssid[i]) in wlan_scan_compare_result()
3719 return (-1); in wlan_scan_compare_result()
3720 if (sr1->bssid[i] > sr2->bssid[i]) in wlan_scan_compare_result()
3732 SLIST_FOREACH(temp, &wif->scanlist, wsr) in wlan_scan_add_result()
3733 if (strlen(temp->ssid) == strlen(sr->ssid) && in wlan_scan_add_result()
3734 strcmp(sr->ssid, temp->ssid) == 0 && in wlan_scan_add_result()
3735 memcmp(sr->bssid, temp->bssid, IEEE80211_ADDR_LEN) == 0) in wlan_scan_add_result()
3736 return (-1); in wlan_scan_add_result()
3738 if ((prev = SLIST_FIRST(&wif->scanlist)) == NULL || in wlan_scan_add_result()
3740 SLIST_INSERT_HEAD(&wif->scanlist, sr, wsr); in wlan_scan_add_result()
3744 SLIST_FOREACH(temp, &wif->scanlist, wsr) { in wlan_scan_add_result()
3759 if ((time(NULL) - wlan_scanlist_age) <= WLAN_LIST_MAXAGE) in wlan_scan_update_results()
3764 if (wif->status != RowStatus_active) in wlan_scan_update_results()
3773 wlan_scanr_index_decode(const struct asn_oid *oid, uint sub, in wlan_scanr_index_decode() argument
3779 if (oid->subs[sub] >= IFNAMSIZ) in wlan_scanr_index_decode()
3780 return (-1); in wlan_scanr_index_decode()
3781 for (i = 0; i < oid->subs[sub]; i++) in wlan_scanr_index_decode()
3782 wname[i] = oid->subs[sub + i + 1]; in wlan_scanr_index_decode()
3783 wname[oid->subs[sub]] = '\0'; in wlan_scanr_index_decode()
3785 offset = sub + oid->subs[sub] + 1; in wlan_scanr_index_decode()
3786 if (oid->subs[offset] > IEEE80211_NWID_LEN) in wlan_scanr_index_decode()
3787 return (-1); in wlan_scanr_index_decode()
3788 for (i = 0; i < oid->subs[offset]; i++) in wlan_scanr_index_decode()
3789 ssid[i] = oid->subs[offset + i + 1]; in wlan_scanr_index_decode()
3792 offset = sub + oid->subs[sub] + oid->subs[offset] + 2; in wlan_scanr_index_decode()
3793 if (oid->subs[offset] != IEEE80211_ADDR_LEN) in wlan_scanr_index_decode()
3794 return (-1); in wlan_scanr_index_decode()
3796 bssid[i] = oid->subs[offset + i + 1]; in wlan_scanr_index_decode()
3802 wlan_append_scanr_index(struct asn_oid *oid, uint sub, char *wname, in wlan_append_scanr_index() argument
3807 oid->len = sub + strlen(wname) + strlen(ssid) + IEEE80211_ADDR_LEN + 3; in wlan_append_scanr_index()
3808 oid->subs[sub] = strlen(wname); in wlan_append_scanr_index()
3810 oid->subs[sub + i] = wname[i - 1]; in wlan_append_scanr_index()
3812 sub += strlen(wname) + 1; in wlan_append_scanr_index()
3813 oid->subs[sub] = strlen(ssid); in wlan_append_scanr_index()
3815 oid->subs[sub + i] = ssid[i - 1]; in wlan_append_scanr_index()
3817 sub += strlen(ssid) + 1; in wlan_append_scanr_index()
3818 oid->subs[sub] = IEEE80211_ADDR_LEN; in wlan_append_scanr_index()
3820 oid->subs[sub + i] = bssid[i - 1]; in wlan_append_scanr_index()
3824 wlan_get_scanr(const struct asn_oid *oid, uint sub, struct wlan_iface **wif) in wlan_get_scanr() argument
3830 if (wlan_scanr_index_decode(oid, sub, wname, ssid, bssid) < 0) in wlan_get_scanr()
3840 wlan_get_next_scanr(const struct asn_oid *oid, uint sub, in wlan_get_next_scanr() argument
3848 if (oid->len - sub == 0) { in wlan_get_next_scanr()
3851 sr = SLIST_FIRST(&(*wif)->scanlist); in wlan_get_next_scanr()
3858 if (wlan_scanr_index_decode(oid, sub, wname, ssid, bssid) < 0 || in wlan_get_next_scanr()
3867 if ((sr = SLIST_FIRST(&(*wif)->scanlist)) != NULL) in wlan_get_next_scanr()
3881 while ((wmm = SLIST_FIRST(&wif->mac_maclist)) != NULL) { in wlan_mac_free_maclist()
3882 SLIST_REMOVE_HEAD(&wif->mac_maclist, wm); in wlan_mac_free_maclist()
3886 SLIST_INIT(&wif->mac_maclist); in wlan_mac_free_maclist()
3894 SLIST_FOREACH(wmm, &wif->mac_maclist, wm) in wlan_mac_find_mac()
3895 if (memcmp(wmm->mac, mac, IEEE80211_ADDR_LEN) == 0) in wlan_mac_find_mac()
3910 memcpy(wmm->mac, mac, IEEE80211_ADDR_LEN); in wlan_mac_new_mac()
3911 wmm->mac_status = RowStatus_notReady; in wlan_mac_new_mac()
3927 SLIST_FOREACH(temp, &wif->mac_maclist, wm) in wlan_mac_add_mac()
3928 if (memcmp(temp->mac, wmm->mac, IEEE80211_ADDR_LEN) == 0) in wlan_mac_add_mac()
3929 return (-1); in wlan_mac_add_mac()
3931 if ((prev = SLIST_FIRST(&wif->mac_maclist)) == NULL || in wlan_mac_add_mac()
3932 memcmp(wmm->mac, prev->mac,IEEE80211_ADDR_LEN) < 0) { in wlan_mac_add_mac()
3933 SLIST_INSERT_HEAD(&wif->mac_maclist, wmm, wm); in wlan_mac_add_mac()
3937 SLIST_FOREACH(temp, &wif->mac_maclist, wm) { in wlan_mac_add_mac()
3938 if (memcmp(wmm->mac, temp->mac, IEEE80211_ADDR_LEN) < 0) in wlan_mac_add_mac()
3950 if (wmm->mac_status == RowStatus_active && in wlan_mac_delete_mac()
3952 return (-1); in wlan_mac_delete_mac()
3954 SLIST_REMOVE(&wif->mac_maclist, wmm, wlan_mac_mac, wm); in wlan_mac_delete_mac()
3966 if ((time(NULL) - wlan_maclist_age) <= WLAN_LIST_MAXAGE) in wlan_mac_update_aclmacs()
3971 if (wif->status != RowStatus_active) in wlan_mac_update_aclmacs()
3974 * Nuke old entries - XXX - they are likely not to in wlan_mac_update_aclmacs()
3975 * change often - reconsider. in wlan_mac_update_aclmacs()
3977 SLIST_FOREACH_SAFE(wmm, &wif->mac_maclist, wm, twmm) in wlan_mac_update_aclmacs()
3978 if (wmm->mac_status == RowStatus_active) { in wlan_mac_update_aclmacs()
3979 SLIST_REMOVE(&wif->mac_maclist, wmm, in wlan_mac_update_aclmacs()
3989 wlan_get_acl_mac(const struct asn_oid *oid, uint sub, struct wlan_iface **wif) in wlan_get_acl_mac() argument
3994 if (wlan_mac_index_decode(oid, sub, wname, mac) < 0) in wlan_get_acl_mac()
4004 wlan_get_next_acl_mac(const struct asn_oid *oid, uint sub, in wlan_get_next_acl_mac() argument
4011 if (oid->len - sub == 0) { in wlan_get_next_acl_mac()
4014 wmm = SLIST_FIRST(&(*wif)->mac_maclist); in wlan_get_next_acl_mac()
4021 if (wlan_mac_index_decode(oid, sub, wname, mac) < 0 || in wlan_get_next_acl_mac()
4030 if ((wmm = SLIST_FIRST(&(*wif)->mac_maclist)) != NULL) in wlan_get_next_acl_mac()
4038 uint sub) in wlan_acl_mac_set_status() argument
4045 if (wlan_mac_index_decode(&val->var, sub, wname, mac) < 0) in wlan_acl_mac_set_status()
4047 macl = wlan_get_acl_mac(&val->var, sub, &wif); in wlan_acl_mac_set_status()
4049 switch (val->v.integer) { in wlan_acl_mac_set_status()
4057 ctx->scratch->int1 = RowStatus_active; in wlan_acl_mac_set_status()
4064 if (wif == NULL || !wif->macsupported) in wlan_acl_mac_set_status()
4070 ctx->scratch->int1 = RowStatus_destroy; in wlan_acl_mac_set_status()
4077 ctx->scratch->int1 = RowStatus_destroy; in wlan_acl_mac_set_status()
4095 if (wif->mode == WlanIfaceOperatingModeType_meshPoint && in wlan_mesh_first_interface()
4096 wif->status == RowStatus_active) in wlan_mesh_first_interface()
4108 if (nwif->mode == WlanIfaceOperatingModeType_meshPoint && in wlan_mesh_next_interface()
4109 nwif->status == RowStatus_active) in wlan_mesh_next_interface()
4118 wlan_mesh_get_iface(const struct asn_oid *oid, uint sub) in wlan_mesh_get_iface() argument
4122 if ((wif = wlan_get_interface(oid, sub)) == NULL) in wlan_mesh_get_iface()
4125 if (wif->mode != WlanIfaceOperatingModeType_meshPoint) in wlan_mesh_get_iface()
4132 wlan_mesh_get_next_iface(const struct asn_oid *oid, uint sub) in wlan_mesh_get_next_iface() argument
4138 if (oid->len - sub == 0) in wlan_mesh_get_next_iface()
4141 if (oid->len - sub != oid->subs[sub] + 1 || oid->subs[sub] >= IFNAMSIZ) in wlan_mesh_get_next_iface()
4145 for (i = 0; i < oid->subs[sub]; i++) in wlan_mesh_get_next_iface()
4146 wname[i] = oid->subs[sub + i + 1]; in wlan_mesh_get_next_iface()
4159 wlan_mesh_get_peer(const struct asn_oid *oid, uint sub, struct wlan_iface **wif) in wlan_mesh_get_peer() argument
4164 if (wlan_mac_index_decode(oid, sub, wname, pmac) < 0) in wlan_mesh_get_peer()
4168 (*wif)->mode != WlanIfaceOperatingModeType_meshPoint) in wlan_mesh_get_peer()
4175 wlan_mesh_get_next_peer(const struct asn_oid *oid, uint sub, struct wlan_iface **wif) in wlan_mesh_get_next_peer() argument
4181 if (oid->len - sub == 0) { in wlan_mesh_get_next_peer()
4184 wip = SLIST_FIRST(&(*wif)->peerlist); in wlan_mesh_get_next_peer()
4191 if (wlan_mac_index_decode(oid, sub, wname, pmac) < 0 || in wlan_mesh_get_next_peer()
4193 (*wif)->mode != WlanIfaceOperatingModeType_meshPoint || in wlan_mesh_get_next_peer()
4201 if ((wip = SLIST_FIRST(&(*wif)->peerlist)) != NULL) in wlan_mesh_get_next_peer()
4215 while ((wmr = SLIST_FIRST(&wif->mesh_routelist)) != NULL) { in wlan_mesh_free_routes()
4216 SLIST_REMOVE_HEAD(&wif->mesh_routelist, wr); in wlan_mesh_free_routes()
4220 SLIST_INIT(&wif->mesh_routelist); in wlan_mesh_free_routes()
4228 if (wif->mode != WlanIfaceOperatingModeType_meshPoint) in wlan_mesh_find_route()
4231 SLIST_FOREACH(wmr, &wif->mesh_routelist, wr) in wlan_mesh_find_route()
4232 if (memcmp(wmr->imroute.imr_dest, dstmac, in wlan_mesh_find_route()
4248 memcpy(wmr->imroute.imr_dest, dstmac, IEEE80211_ADDR_LEN); in wlan_mesh_new_route()
4249 wmr->mroute_status = RowStatus_notReady; in wlan_mesh_new_route()
4265 SLIST_FOREACH(temp, &wif->mesh_routelist, wr) in wlan_mesh_add_rtentry()
4266 if (memcmp(temp->imroute.imr_dest, wmr->imroute.imr_dest, in wlan_mesh_add_rtentry()
4268 return (-1); in wlan_mesh_add_rtentry()
4270 if ((prev = SLIST_FIRST(&wif->mesh_routelist)) == NULL || in wlan_mesh_add_rtentry()
4271 memcmp(wmr->imroute.imr_dest, prev->imroute.imr_dest, in wlan_mesh_add_rtentry()
4273 SLIST_INSERT_HEAD(&wif->mesh_routelist, wmr, wr); in wlan_mesh_add_rtentry()
4277 SLIST_FOREACH(temp, &wif->mesh_routelist, wr) { in wlan_mesh_add_rtentry()
4278 if (memcmp(wmr->imroute.imr_dest, temp->imroute.imr_dest, in wlan_mesh_add_rtentry()
4291 if (wmr->mroute_status == RowStatus_active && in wlan_mesh_delete_route()
4293 return (-1); in wlan_mesh_delete_route()
4295 SLIST_REMOVE(&wif->mesh_routelist, wmr, wlan_mesh_route, wr); in wlan_mesh_delete_route()
4307 if ((time(NULL) - wlan_mrlist_age) <= WLAN_LIST_MAXAGE) in wlan_mesh_update_routes()
4313 * Nuke old entries - XXX - they are likely not to in wlan_mesh_update_routes()
4314 * change often - reconsider. in wlan_mesh_update_routes()
4316 SLIST_FOREACH_SAFE(wmr, &wif->mesh_routelist, wr, twmr) in wlan_mesh_update_routes()
4317 if (wmr->mroute_status == RowStatus_active) { in wlan_mesh_update_routes()
4318 SLIST_REMOVE(&wif->mesh_routelist, wmr, in wlan_mesh_update_routes()
4328 wlan_mesh_get_route(const struct asn_oid *oid, uint sub, struct wlan_iface **wif) in wlan_mesh_get_route() argument
4333 if (wlan_mac_index_decode(oid, sub, wname, dstmac) < 0) in wlan_mesh_get_route()
4343 wlan_mesh_get_next_route(const struct asn_oid *oid, uint sub, in wlan_mesh_get_next_route() argument
4350 if (oid->len - sub == 0) { in wlan_mesh_get_next_route()
4353 wmr = SLIST_FIRST(&(*wif)->mesh_routelist); in wlan_mesh_get_next_route()
4360 if (wlan_mac_index_decode(oid, sub, wname, dstmac) < 0 || in wlan_mesh_get_next_route()
4369 if ((wmr = SLIST_FIRST(&(*wif)->mesh_routelist)) != NULL) in wlan_mesh_get_next_route()
4377 uint sub) in wlan_mesh_route_set_status() argument
4384 if (wlan_mac_index_decode(&val->var, sub, wname, mac) < 0) in wlan_mesh_route_set_status()
4386 wmr = wlan_mesh_get_route(&val->var, sub, &wif); in wlan_mesh_route_set_status()
4388 switch (val->v.integer) { in wlan_mesh_route_set_status()
4396 ctx->scratch->int1 = RowStatus_active; in wlan_mesh_route_set_status()
4413 ctx->scratch->int1 = RowStatus_destroy; in wlan_mesh_route_set_status()
4431 return (-1); in wlan_init()
4434 return (-1); in wlan_init()
4440 return (-1); in wlan_init()
4499 syslog(LOG_ERR, "wlan iface %s", wif->wname); in wlan_dump()