Deleted Added
full compact
ieee80211_freebsd.c (190579) ieee80211_freebsd.c (191816)
1/*-
2 * Copyright (c) 2003-2009 Sam Leffler, Errno Consulting
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 10 unchanged lines hidden (view full) ---

19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2003-2009 Sam Leffler, Errno Consulting
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 10 unchanged lines hidden (view full) ---

19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#include <sys/cdefs.h>
27__FBSDID("$FreeBSD: head/sys/net80211/ieee80211_freebsd.c 190579 2009-03-30 21:53:27Z sam $");
27__FBSDID("$FreeBSD: head/sys/net80211/ieee80211_freebsd.c 191816 2009-05-05 10:56:12Z zec $");
28
29/*
30 * IEEE 802.11 support (FreeBSD-specific code)
31 */
32#include "opt_wlan.h"
33
34#include <sys/param.h>
35#include <sys/kernel.h>
36#include <sys/systm.h>
37#include <sys/linker.h>
38#include <sys/mbuf.h>
39#include <sys/module.h>
40#include <sys/proc.h>
41#include <sys/sysctl.h>
42
43#include <sys/socket.h>
28
29/*
30 * IEEE 802.11 support (FreeBSD-specific code)
31 */
32#include "opt_wlan.h"
33
34#include <sys/param.h>
35#include <sys/kernel.h>
36#include <sys/systm.h>
37#include <sys/linker.h>
38#include <sys/mbuf.h>
39#include <sys/module.h>
40#include <sys/proc.h>
41#include <sys/sysctl.h>
42
43#include <sys/socket.h>
44#include <sys/vimage.h>
44
45#include <net/if.h>
46#include <net/if_dl.h>
47#include <net/if_clone.h>
48#include <net/if_media.h>
49#include <net/if_types.h>
50#include <net/ethernet.h>
51#include <net/route.h>

--- 441 unchanged lines hidden (view full) ---

493/*
494 * Helper function for events that pass just a single mac address.
495 */
496static void
497notify_macaddr(struct ifnet *ifp, int op, const uint8_t mac[IEEE80211_ADDR_LEN])
498{
499 struct ieee80211_join_event iev;
500
45
46#include <net/if.h>
47#include <net/if_dl.h>
48#include <net/if_clone.h>
49#include <net/if_media.h>
50#include <net/if_types.h>
51#include <net/ethernet.h>
52#include <net/route.h>

--- 441 unchanged lines hidden (view full) ---

494/*
495 * Helper function for events that pass just a single mac address.
496 */
497static void
498notify_macaddr(struct ifnet *ifp, int op, const uint8_t mac[IEEE80211_ADDR_LEN])
499{
500 struct ieee80211_join_event iev;
501
502 CURVNET_SET(ifp->if_vnet);
501 memset(&iev, 0, sizeof(iev));
502 IEEE80211_ADDR_COPY(iev.iev_addr, mac);
503 rt_ieee80211msg(ifp, op, &iev, sizeof(iev));
503 memset(&iev, 0, sizeof(iev));
504 IEEE80211_ADDR_COPY(iev.iev_addr, mac);
505 rt_ieee80211msg(ifp, op, &iev, sizeof(iev));
506 CURVNET_RESTORE();
504}
505
506void
507ieee80211_notify_node_join(struct ieee80211_node *ni, int newassoc)
508{
509 struct ieee80211vap *vap = ni->ni_vap;
510 struct ifnet *ifp = vap->iv_ifp;
511
507}
508
509void
510ieee80211_notify_node_join(struct ieee80211_node *ni, int newassoc)
511{
512 struct ieee80211vap *vap = ni->ni_vap;
513 struct ifnet *ifp = vap->iv_ifp;
514
515 CURVNET_SET_QUIET(ifp->if_vnet);
512 IEEE80211_NOTE(vap, IEEE80211_MSG_NODE, ni, "%snode join",
513 (ni == vap->iv_bss) ? "bss " : "");
514
515 if (ni == vap->iv_bss) {
516 notify_macaddr(ifp, newassoc ?
517 RTM_IEEE80211_ASSOC : RTM_IEEE80211_REASSOC, ni->ni_bssid);
518 if_link_state_change(ifp, LINK_STATE_UP);
519 } else {
520 notify_macaddr(ifp, newassoc ?
521 RTM_IEEE80211_JOIN : RTM_IEEE80211_REJOIN, ni->ni_macaddr);
522 }
516 IEEE80211_NOTE(vap, IEEE80211_MSG_NODE, ni, "%snode join",
517 (ni == vap->iv_bss) ? "bss " : "");
518
519 if (ni == vap->iv_bss) {
520 notify_macaddr(ifp, newassoc ?
521 RTM_IEEE80211_ASSOC : RTM_IEEE80211_REASSOC, ni->ni_bssid);
522 if_link_state_change(ifp, LINK_STATE_UP);
523 } else {
524 notify_macaddr(ifp, newassoc ?
525 RTM_IEEE80211_JOIN : RTM_IEEE80211_REJOIN, ni->ni_macaddr);
526 }
527 CURVNET_RESTORE();
523}
524
525void
526ieee80211_notify_node_leave(struct ieee80211_node *ni)
527{
528 struct ieee80211vap *vap = ni->ni_vap;
529 struct ifnet *ifp = vap->iv_ifp;
530
528}
529
530void
531ieee80211_notify_node_leave(struct ieee80211_node *ni)
532{
533 struct ieee80211vap *vap = ni->ni_vap;
534 struct ifnet *ifp = vap->iv_ifp;
535
536 CURVNET_SET_QUIET(ifp->if_vnet);
531 IEEE80211_NOTE(vap, IEEE80211_MSG_NODE, ni, "%snode leave",
532 (ni == vap->iv_bss) ? "bss " : "");
533
534 if (ni == vap->iv_bss) {
535 rt_ieee80211msg(ifp, RTM_IEEE80211_DISASSOC, NULL, 0);
536 if_link_state_change(ifp, LINK_STATE_DOWN);
537 } else {
538 /* fire off wireless event station leaving */
539 notify_macaddr(ifp, RTM_IEEE80211_LEAVE, ni->ni_macaddr);
540 }
537 IEEE80211_NOTE(vap, IEEE80211_MSG_NODE, ni, "%snode leave",
538 (ni == vap->iv_bss) ? "bss " : "");
539
540 if (ni == vap->iv_bss) {
541 rt_ieee80211msg(ifp, RTM_IEEE80211_DISASSOC, NULL, 0);
542 if_link_state_change(ifp, LINK_STATE_DOWN);
543 } else {
544 /* fire off wireless event station leaving */
545 notify_macaddr(ifp, RTM_IEEE80211_LEAVE, ni->ni_macaddr);
546 }
547 CURVNET_RESTORE();
541}
542
543void
544ieee80211_notify_scan_done(struct ieee80211vap *vap)
545{
546 struct ifnet *ifp = vap->iv_ifp;
547
548 IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN, "%s\n", "notify scan done");
549
550 /* dispatch wireless event indicating scan completed */
548}
549
550void
551ieee80211_notify_scan_done(struct ieee80211vap *vap)
552{
553 struct ifnet *ifp = vap->iv_ifp;
554
555 IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN, "%s\n", "notify scan done");
556
557 /* dispatch wireless event indicating scan completed */
558 CURVNET_SET(ifp->if_vnet);
551 rt_ieee80211msg(ifp, RTM_IEEE80211_SCAN, NULL, 0);
559 rt_ieee80211msg(ifp, RTM_IEEE80211_SCAN, NULL, 0);
560 CURVNET_RESTORE();
552}
553
554void
555ieee80211_notify_replay_failure(struct ieee80211vap *vap,
556 const struct ieee80211_frame *wh, const struct ieee80211_key *k,
557 u_int64_t rsc)
558{
559 struct ifnet *ifp = vap->iv_ifp;

--- 11 unchanged lines hidden (view full) ---

571 IEEE80211_ADDR_COPY(iev.iev_src, wh->i_addr2);
572 iev.iev_cipher = k->wk_cipher->ic_cipher;
573 if (k->wk_rxkeyix != IEEE80211_KEYIX_NONE)
574 iev.iev_keyix = k->wk_rxkeyix;
575 else
576 iev.iev_keyix = k->wk_keyix;
577 iev.iev_keyrsc = k->wk_keyrsc[0]; /* XXX need tid */
578 iev.iev_rsc = rsc;
561}
562
563void
564ieee80211_notify_replay_failure(struct ieee80211vap *vap,
565 const struct ieee80211_frame *wh, const struct ieee80211_key *k,
566 u_int64_t rsc)
567{
568 struct ifnet *ifp = vap->iv_ifp;

--- 11 unchanged lines hidden (view full) ---

580 IEEE80211_ADDR_COPY(iev.iev_src, wh->i_addr2);
581 iev.iev_cipher = k->wk_cipher->ic_cipher;
582 if (k->wk_rxkeyix != IEEE80211_KEYIX_NONE)
583 iev.iev_keyix = k->wk_rxkeyix;
584 else
585 iev.iev_keyix = k->wk_keyix;
586 iev.iev_keyrsc = k->wk_keyrsc[0]; /* XXX need tid */
587 iev.iev_rsc = rsc;
588 CURVNET_SET(ifp->if_vnet);
579 rt_ieee80211msg(ifp, RTM_IEEE80211_REPLAY, &iev, sizeof(iev));
589 rt_ieee80211msg(ifp, RTM_IEEE80211_REPLAY, &iev, sizeof(iev));
590 CURVNET_RESTORE();
580 }
581}
582
583void
584ieee80211_notify_michael_failure(struct ieee80211vap *vap,
585 const struct ieee80211_frame *wh, u_int keyix)
586{
587 struct ifnet *ifp = vap->iv_ifp;

--- 4 unchanged lines hidden (view full) ---

592
593 if (ifp != NULL) { /* NB: for cipher test modules */
594 struct ieee80211_michael_event iev;
595
596 IEEE80211_ADDR_COPY(iev.iev_dst, wh->i_addr1);
597 IEEE80211_ADDR_COPY(iev.iev_src, wh->i_addr2);
598 iev.iev_cipher = IEEE80211_CIPHER_TKIP;
599 iev.iev_keyix = keyix;
591 }
592}
593
594void
595ieee80211_notify_michael_failure(struct ieee80211vap *vap,
596 const struct ieee80211_frame *wh, u_int keyix)
597{
598 struct ifnet *ifp = vap->iv_ifp;

--- 4 unchanged lines hidden (view full) ---

603
604 if (ifp != NULL) { /* NB: for cipher test modules */
605 struct ieee80211_michael_event iev;
606
607 IEEE80211_ADDR_COPY(iev.iev_dst, wh->i_addr1);
608 IEEE80211_ADDR_COPY(iev.iev_src, wh->i_addr2);
609 iev.iev_cipher = IEEE80211_CIPHER_TKIP;
610 iev.iev_keyix = keyix;
611 CURVNET_SET(ifp->if_vnet);
600 rt_ieee80211msg(ifp, RTM_IEEE80211_MICHAEL, &iev, sizeof(iev));
612 rt_ieee80211msg(ifp, RTM_IEEE80211_MICHAEL, &iev, sizeof(iev));
613 CURVNET_RESTORE();
601 }
602}
603
604void
605ieee80211_notify_wds_discover(struct ieee80211_node *ni)
606{
607 struct ieee80211vap *vap = ni->ni_vap;
608 struct ifnet *ifp = vap->iv_ifp;

--- 138 unchanged lines hidden ---
614 }
615}
616
617void
618ieee80211_notify_wds_discover(struct ieee80211_node *ni)
619{
620 struct ieee80211vap *vap = ni->ni_vap;
621 struct ifnet *ifp = vap->iv_ifp;

--- 138 unchanged lines hidden ---