Deleted Added
full compact
ieee80211_input.c (167440) ieee80211_input.c (167441)
1/*-
2 * Copyright (c) 2001 Atsushi Onoe
3 * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2001 Atsushi Onoe
3 * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#include <sys/cdefs.h>
34__FBSDID("$FreeBSD: head/sys/net80211/ieee80211_input.c 167440 2007-03-11 07:08:04Z sam $");
34__FBSDID("$FreeBSD: head/sys/net80211/ieee80211_input.c 167441 2007-03-11 07:15:38Z sam $");
35
36#include <sys/param.h>
37#include <sys/systm.h>
38#include <sys/mbuf.h>
39#include <sys/malloc.h>
40#include <sys/endian.h>
41#include <sys/kernel.h>
42

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

68 case IEEE80211_FC0_SUBTYPE_BEACON:
69 return (ic->ic_flags & IEEE80211_F_SCAN);
70 case IEEE80211_FC0_SUBTYPE_PROBE_REQ:
71 return (ic->ic_opmode == IEEE80211_M_IBSS);
72 }
73 return 1;
74}
75
35
36#include <sys/param.h>
37#include <sys/systm.h>
38#include <sys/mbuf.h>
39#include <sys/malloc.h>
40#include <sys/endian.h>
41#include <sys/kernel.h>
42

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

68 case IEEE80211_FC0_SUBTYPE_BEACON:
69 return (ic->ic_flags & IEEE80211_F_SCAN);
70 case IEEE80211_FC0_SUBTYPE_PROBE_REQ:
71 return (ic->ic_opmode == IEEE80211_M_IBSS);
72 }
73 return 1;
74}
75
76/*
77 * Emit a debug message about discarding a frame or information
78 * element. One format is for extracting the mac address from
79 * the frame header; the other is for when a header is not
80 * available or otherwise appropriate.
81 */
82#define IEEE80211_DISCARD(_ic, _m, _wh, _type, _fmt, ...) do { \
83 if ((_ic)->ic_debug & (_m)) \
84 ieee80211_discard_frame(_ic, _wh, _type, _fmt, __VA_ARGS__);\
85} while (0)
86#define IEEE80211_DISCARD_IE(_ic, _m, _wh, _type, _fmt, ...) do { \
87 if ((_ic)->ic_debug & (_m)) \
88 ieee80211_discard_ie(_ic, _wh, _type, _fmt, __VA_ARGS__);\
89} while (0)
90#define IEEE80211_DISCARD_MAC(_ic, _m, _mac, _type, _fmt, ...) do { \
91 if ((_ic)->ic_debug & (_m)) \
92 ieee80211_discard_mac(_ic, _mac, _type, _fmt, __VA_ARGS__);\
93} while (0)
94
95static const u_int8_t *ieee80211_getbssid(struct ieee80211com *,
96 const struct ieee80211_frame *);
76static const u_int8_t *ieee80211_getbssid(struct ieee80211com *,
77 const struct ieee80211_frame *);
97static void ieee80211_discard_frame(struct ieee80211com *,
98 const struct ieee80211_frame *, const char *type, const char *fmt, ...);
99static void ieee80211_discard_ie(struct ieee80211com *,
100 const struct ieee80211_frame *, const char *type, const char *fmt, ...);
101static void ieee80211_discard_mac(struct ieee80211com *,
102 const u_int8_t mac[IEEE80211_ADDR_LEN], const char *type,
103 const char *fmt, ...);
104#else
105#define IEEE80211_DISCARD(_ic, _m, _wh, _type, _fmt, ...)
106#define IEEE80211_DISCARD_IE(_ic, _m, _wh, _type, _fmt, ...)
107#define IEEE80211_DISCARD_MAC(_ic, _m, _mac, _type, _fmt, ...)
108#endif /* IEEE80211_DEBUG */
109
110static struct mbuf *ieee80211_defrag(struct ieee80211com *,
111 struct ieee80211_node *, struct mbuf *, int);
112static struct mbuf *ieee80211_decap(struct ieee80211com *, struct mbuf *, int);
113static void ieee80211_send_error(struct ieee80211com *, struct ieee80211_node *,
114 const u_int8_t *mac, int subtype, int arg);
115static void ieee80211_deliver_data(struct ieee80211com *,

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

2862 va_list ap;
2863
2864 va_start(ap, fmt);
2865 vsnprintf(buf, sizeof(buf), fmt, ap);
2866 va_end(ap);
2867 if_printf(ic->ic_ifp, "[%s] %s\n", ether_sprintf(mac), buf);
2868}
2869
78#endif /* IEEE80211_DEBUG */
79
80static struct mbuf *ieee80211_defrag(struct ieee80211com *,
81 struct ieee80211_node *, struct mbuf *, int);
82static struct mbuf *ieee80211_decap(struct ieee80211com *, struct mbuf *, int);
83static void ieee80211_send_error(struct ieee80211com *, struct ieee80211_node *,
84 const u_int8_t *mac, int subtype, int arg);
85static void ieee80211_deliver_data(struct ieee80211com *,

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

2832 va_list ap;
2833
2834 va_start(ap, fmt);
2835 vsnprintf(buf, sizeof(buf), fmt, ap);
2836 va_end(ap);
2837 if_printf(ic->ic_ifp, "[%s] %s\n", ether_sprintf(mac), buf);
2838}
2839
2870static void
2840void
2871ieee80211_discard_frame(struct ieee80211com *ic,
2872 const struct ieee80211_frame *wh,
2873 const char *type, const char *fmt, ...)
2874{
2875 va_list ap;
2876
2877 printf("[%s:%s] discard ", ic->ic_ifp->if_xname,
2878 ether_sprintf(ieee80211_getbssid(ic, wh)));
2879 if (type != NULL)
2880 printf("%s frame, ", type);
2881 else
2882 printf("frame, ");
2883 va_start(ap, fmt);
2884 vprintf(fmt, ap);
2885 va_end(ap);
2886 printf("\n");
2887}
2888
2841ieee80211_discard_frame(struct ieee80211com *ic,
2842 const struct ieee80211_frame *wh,
2843 const char *type, const char *fmt, ...)
2844{
2845 va_list ap;
2846
2847 printf("[%s:%s] discard ", ic->ic_ifp->if_xname,
2848 ether_sprintf(ieee80211_getbssid(ic, wh)));
2849 if (type != NULL)
2850 printf("%s frame, ", type);
2851 else
2852 printf("frame, ");
2853 va_start(ap, fmt);
2854 vprintf(fmt, ap);
2855 va_end(ap);
2856 printf("\n");
2857}
2858
2889static void
2859void
2890ieee80211_discard_ie(struct ieee80211com *ic,
2891 const struct ieee80211_frame *wh,
2892 const char *type, const char *fmt, ...)
2893{
2894 va_list ap;
2895
2896 printf("[%s:%s] discard ", ic->ic_ifp->if_xname,
2897 ether_sprintf(ieee80211_getbssid(ic, wh)));
2898 if (type != NULL)
2899 printf("%s information element, ", type);
2900 else
2901 printf("information element, ");
2902 va_start(ap, fmt);
2903 vprintf(fmt, ap);
2904 va_end(ap);
2905 printf("\n");
2906}
2907
2860ieee80211_discard_ie(struct ieee80211com *ic,
2861 const struct ieee80211_frame *wh,
2862 const char *type, const char *fmt, ...)
2863{
2864 va_list ap;
2865
2866 printf("[%s:%s] discard ", ic->ic_ifp->if_xname,
2867 ether_sprintf(ieee80211_getbssid(ic, wh)));
2868 if (type != NULL)
2869 printf("%s information element, ", type);
2870 else
2871 printf("information element, ");
2872 va_start(ap, fmt);
2873 vprintf(fmt, ap);
2874 va_end(ap);
2875 printf("\n");
2876}
2877
2908static void
2878void
2909ieee80211_discard_mac(struct ieee80211com *ic,
2910 const u_int8_t mac[IEEE80211_ADDR_LEN],
2911 const char *type, const char *fmt, ...)
2912{
2913 va_list ap;
2914
2915 printf("[%s:%s] discard ", ic->ic_ifp->if_xname, ether_sprintf(mac));
2916 if (type != NULL)
2917 printf("%s frame, ", type);
2918 else
2919 printf("frame, ");
2920 va_start(ap, fmt);
2921 vprintf(fmt, ap);
2922 va_end(ap);
2923 printf("\n");
2924}
2925#endif /* IEEE80211_DEBUG */
2879ieee80211_discard_mac(struct ieee80211com *ic,
2880 const u_int8_t mac[IEEE80211_ADDR_LEN],
2881 const char *type, const char *fmt, ...)
2882{
2883 va_list ap;
2884
2885 printf("[%s:%s] discard ", ic->ic_ifp->if_xname, ether_sprintf(mac));
2886 if (type != NULL)
2887 printf("%s frame, ", type);
2888 else
2889 printf("frame, ");
2890 va_start(ap, fmt);
2891 vprintf(fmt, ap);
2892 va_end(ap);
2893 printf("\n");
2894}
2895#endif /* IEEE80211_DEBUG */