Thursday, April 5, 2012

Live Monitoring and Writing Raw 802.11 Packets

This is an excerpt from a complete article I found online. Interesting:
The madwifi driver can be used in a live "monitor" mode, by creating a monitor VAP and sending packets to it. All packets sent to a monitor mode VAP will bypass any state machine.  

To create a monitor VAP, use:  
wlanconfig ath1 create wlandev wifi0 wlanmode monitor  ifconfig ath1 up  
Finally, you can choose to receive packets on ath1 in several different packet formats:  
echo '801' > /proc/sys/net/ath1/dev_type # only 802.11 headers  
echo '802' > /proc/sys/net/ath1/dev_type # prism2 headers  
echo '803' > /proc/sys/net/ath1/dev_type # radiotap headers  
echo '804' > /proc/sys/net/ath1/dev_type # atheros descriptors

Sunday, April 1, 2012

Why is the linux kernel code written only in C

The kernel code or kernel-space code is only written in C and no other language.

Ever wondered why?

This was nicely answered on one  of the forums:

"In fact, in Linux we did try C++ once already, back in 1992. It sucks. Trust me - writing kernel code in C++ is a BLOODY STUPID IDEA.
"The fact is, C++ compilers are not trustworthy. They were even worse in
1992, but some fundamental facts haven't changed: 1) the whole C++ exception handling thing is fundamentally broken. It's _especially_ broken for kernels. 2) any compiler or language that likes to hide things like memory allocations behind your back just isn't a good choice for a kernel. 3) you can write object-oriented code (useful for filesystems etc) in C, _without_ the crap that is C++."