SlideShare a Scribd company logo
Opening Nuts and Bolts of Linux
WiFi Subsystem
Dheryta Jaisinghani
Why do we
need to
understand
this?
I wonder
● What happens in the background (in the
Operating System) when I connect to WiFi?
● How does a packet travels all the way from my
application to kernel to air and back?
● How can I modify the code to try my own
algorithms?
2
Structure of
this talk
● Linux WiFi Subsystem - Bird’s Eye View
● Types of WiFi drivers
● Working with code - Source, Compilation,
Kernel Module Insertion
● Flow of code - where to make changes
● Important commands - events, connection
establishment, information on card and
modules, logging
● Important pointers - Tutorials
3
Networking
Layers
Application
Presentation
Session
Transport
Network
MLME|MAC
Physical
WiFi -
IEEE 802.11
4
What does
MAC -
Medium
Access
Control do?
● MLME - MAC SubLayer Management Entity
○ Authenticate
○ Deauthenticate
○ Associate
○ Disassociate
○ Reassociate
○ Beacon
○ Probe
5
Know about your WiFi card
6
7
sudo lshw -C network
8
iwconfig
ifconfig
WiFi
connection
in
Application
Layer?
● WPA_Supplicant
● WICD
● Network Manager
● More ...
9
Types of
WiFi
Devices
Full MAC:
MAC in
hardware
[1] https://wireless.wiki.kernel.org/en/developers/documentation/glossary
Soft MAC:
MAC in
software
10
WiFi
Interface
Modes
[1] https://wireless.wiki.kernel.org/en/developers/documentation/glossary
11
Linux WiFi Subsystem - Bird’s Eye View
[1] D. Jaisinghani, -, S. Kaul, and S. Roy. Sniffer-based Inference of the Causes of Active Scanning in WiFi Networks. NCC 2017
12
What
happens
when a WiFi
card is
plugged in?
● Device drivers load order -
○ cfg80211 -> mac80211 -> ath9k
● LibNL, Wireless Information
○ /usr/include/linux/nl80211.h
○ /proc/net/wireless
○ /proc/net/dev
● Events
○ WiFi connection establishment -
■ Associate
■ Authenticate
○ DHCP
■ Network - IP
● Terminal command - tail -f /var/log/syslog or
dmesg (Look for keywords - wpa_supplicant,
network manager, kernel, dhclient)
[1] http://moi.vonos.net/linux/wireless-stack/
13
Live Demonstration
14
1. Open 2 terminals - terminal 1 and terminal 2
2. In terminal 1 - sudo tail -f /var/log/syslog
3. In terminal 2 - sudo rmmod ath9k
4. Notice the messages in terminal 1
5. In terminal 2 - sudo modprobe ath9k
6. Notice the messages in terminal 2
15
Feb 25 12:04:08 Laptop kernel:
[38508.139858] ath: phy2: ASPM
enabled: 0x42
Feb 25 12:04:08 Laptop kernel:
[38508.140435] ieee80211 phy2:
Selected rate control algorithm
'minstrel_ht'
Feb 25 12:04:08 Laptop
NetworkManager[952]: <info>
(wlan0): using nl80211 for WiFi
device control
Feb 25 12:04:08 Laptop
NetworkManager[952]: <info>
(wlan0): new 802.11 WiFi device
(driver: 'ath9k' ifindex: 6)
Feb 25 12:04:08 Laptop NetworkManager[952]: <info>
(wlan0): using nl80211 for WiFi device control
Feb 25 12:04:08 Laptop NetworkManager[952]: <info>
(wlan0): new 802.11 WiFi device (driver: 'ath9k' ifindex: 6)
Feb 25 12:04:08 Laptop NetworkManager[952]: <info>
NetworkManager state is now DISCONNECTED
Feb 25 12:04:09 Laptop wpa_supplicant[5068]: wlan0:
CTRL-EVENT-SCAN-STARTED
Feb 25 12:04:12 Laptop NetworkManager[952]: <info>
Auto-activating connection 'FACULTY-STAFF-N'.
Feb 25 12:04:12 Laptop NetworkManager[952]: <info>
(wlan0): device state change: config -> need-auth (reason
'none') [50 60 0]
Feb 25 12:04:12 Laptop wpa_supplicant[5068]: wlan0: SME:
Trying to authenticate with c4:0a:cb:5c:07:0a
(SSID='FACULTY-STAFF-N' freq=5280 MHz)
Feb 25 12:04:12 Laptop NetworkManager[952]: <info>
(wlan0): supplicant interface state: inactive -> authenticating
16
Feb 25 12:04:16 Laptop
wpa_supplicant[5068]: wlan0:
Trying to associate with
c4:0a:cb:5c:07:0a
(SSID='FACULTY-STAFF-N'
freq=5280 MHz)
Feb 25 12:04:16 Laptop kernel:
[38515.397527] wlan0: send auth
to c4:0a:cb:5c:07:0a (try 2/3)
Feb 25 12:04:16 Laptop kernel:
[38515.398891] wlan0:
authenticated
Feb 25 12:04:16 Laptop kernel:
[38515.401031] wlan0: associate
with c4:0a:cb:5c:07:0a (try 1/3)
Feb 25 12:04:16 Laptop kernel:
[38515.402612] wlan0: RX
AssocResp from c4:0a:cb:5c:07:0a
(capab=0x11 status=0 aid=2)
Feb 25 12:04:16 Laptop kernel:
[38515.402686] wlan0: associated
Feb 25 12:04:16 Laptop NetworkManager[952]: <info> (wlan0):
device state change: config -> ip-config (reason 'none') [50 70
0]
Feb 25 12:04:16 Laptop NetworkManager[952]: <info>
Activation (wlan0) Beginning DHCPv4 transaction (timeout in
45 seconds)
Feb 25 12:04:16 Laptop NetworkManager[952]: <info> dhclient
started with pid 6172
Feb 25 12:04:16 Laptop NetworkManager[952]: <info>
address 192.168.X.X
Feb 25 12:04:16 Laptop NetworkManager[952]: <info> prefix
20 (255.255.240.0)
Feb 25 12:04:16 Laptop NetworkManager[952]: <info>
gateway 192.168.X.X
Feb 25 12:04:16 Laptop NetworkManager[952]: <info>
nameserver '192.168.X.X'
Feb 25 12:04:16 Laptop NetworkManager[952]: <info>
domain name 'iiitd.edu.in'
17
watch -n1 "cat /proc/net/wireless"
watch -n1 "cat /proc/net/dev"
18
Flow of
Packets in an
Operating
System
● Data vs Control Path
● Transmit vs Receive Path
19
Data Application
System Call
Sockets
Network Protocols
Net_dev core
Driver
Network Application
nl80211
cfg80211
mac80211
Data Path Control Path
[1] https://www.linux.com/blog/linux-wireless-networking-short-walk
20
Backports Code Structure
21
net/wireless/handlers/wireless/nl80211.c (struct
genl_opsnl80211_ops)
nl80211
cfg80211
mac80211
ath9k
net/wireless (Configurations) - Struct cfg80211_ops
/net/mac80211 (Rate Control, MLME-Authenticate,
Reassociate, Deauthenticate, Associate,
Disassociate, Beacon , Probe, PM, Scan, Retries,
ACK Handling, etc) - struct ieee80211_ops
drivers/net/wireless/ath/ath9k (Transmit and
Receive)
22
How is a Packet Received?
Main.c: Interrupt from hardware to
ath9k: irqreturn_t ath_isr
Recv.c : ath_rx_tasklet ()
rx.c : ieee80211_rx () ->
ieee80211_prepare_and_rx_handle() ->
ieee80211_rx_handlers() ->
ieee80211_deliver_skb() - go up or down to air ->
● netif_receive_skb() (rx.c) - up
● dev_queue_xmit() - send to air
[1] http://www.campsmur.cat/files/mac80211_intro.pdf
23
How is a packet transmitted?
Kernel to interface (virtual)
Tx.c - ieee80211_subif_start_xmit()
Tx.c - ieee80211_xmit()
Tx.c - ieee80211_tx()
<ieee80211_ops>
main.c - ath9k_tx() - struct
ath_tx (ath9k.h) - 10 TX queues
xmit.c - ath_tx_start ()
xmit.c - ath_tx_txqaddbuf ()
mac.c - ath9k_hw_txstart()
Writes register in hardware
to perform transmission
[1] http://www.campsmur.cat/files/mac80211_intro.pdf
24
Debugging
Options
Debug Ath9k
1. sudo make menuconfig - Enable debug options as specified
in the above mentioned link
2. sudo make
3. sudo make install with flags
4. modprobe ath9k debug=0x00000200 (or) modprobe
ath9k_htc debug=0x00000200
5. ATH_DBG_ANY = 0xffffffff
6. tail -f /var/log/syslog
Debug mac80211/cfg80211
1. sudo modprobe mac80211 debug=0xffffffff
2. sudo trace-cmd record -e mac80211
3. trace-cmd report -i trace.dat | grep scan
25
Live Demonstration
26
sudo watch -n1 “cat /sys/kernel/debug/ieee80211/phy4/ath9k/recv”
27
sudo watch -n1 “cat /sys/kernel/debug/ieee80211/phy4/ath9k/xmit”
28
Important
and Useful
Commands
● Wireless Events (scan, authentication etc) -
sudo iw event -t
● Connection Stats (inactive time, rx/tx
bytes/packets, signal, bitrate etc) - sudo iw dev
wlan0 station dump
● Regular Monitoring - watch -n1 “<command>”
● lshw -C network, lsusb, lspci
● Debug Messages - tail -f /var/log/syslog,
dmesg
29
Important
URLs
● All about Wireless Kernel:
https://wireless.wiki.kernel.org/en/users
● Tracing the code paths:
http://blog.cerowrt.org/post/wifi_software_paths/
● Networking Stack Programming:
http://www.geeksofpune.in/files/GEEP-NetworkingSt
ack-28may14.pdf
● Download backports:
○ https://backports.wiki.kernel.org/index.php/Main_Pag
e
○ http://drvbp1.linux-foundation.org/~mcgrof/rel-html/b
ackports/
● Debugging backports:
https://wireless.wiki.kernel.org/en/users/drivers/ath
9k/debug
30
Questions?
● Webpage: www.dheryta.co.in
● E-Mail: dherytaj@iiitd.ac.in
31
Abstract
Title: Opening Nuts and Bolts of Linux WiFi Subsystem
While we understand the complex interplay of OSI layers, in theory, in practice understanding their implementation is a
non-trivial task. The implementation details that enables a network interface card to communicate with its peers are
oblivious to the end-users. Naive developers such as undergraduate and graduate students often find it hard to find relevant
tutorials that enable them to understand these implementation details.
The aim of this talk is to provide an overview of WiFi Subsystem implemented in the Linux operating system. Specifically,
this talk will explain the sequence of events that occur from application layer till physical layer when a connection is
established over WiFi.
After this talk, the audience will understand -- (1) the bird's eye view of Linux WiFi Subsystem, (2) what happens in an
operating system when a WiFi card is plugged-in, (3) how is a packet received/transmitted from physical layer to operating
system kernel and vice-versa, (4) brief overview of code structure of open-source drivers, and lastly (5) important pointers
to kickstart driver code modifications.
Duration: 30-40 minutes Add-ons: Minimal Demonstration
32

More Related Content

What's hot

The Linux Block Layer - Built for Fast Storage
The Linux Block Layer - Built for Fast StorageThe Linux Block Layer - Built for Fast Storage
The Linux Block Layer - Built for Fast Storage
Kernel TLV
 
Linux dma engine
Linux dma engineLinux dma engine
Linux dma engine
pradeep_tewani
 
DPDK & Layer 4 Packet Processing
DPDK & Layer 4 Packet ProcessingDPDK & Layer 4 Packet Processing
DPDK & Layer 4 Packet Processing
Michelle Holley
 
Implementation of MAC-level sleep-scheduling
Implementation of MAC-level sleep-schedulingImplementation of MAC-level sleep-scheduling
Implementation of MAC-level sleep-schedulingOlivier Cervello
 
Embedded linux network device driver development
Embedded linux network device driver developmentEmbedded linux network device driver development
Embedded linux network device driver development
Amr Ali (ISTQB CTAL Full, CSM, ITIL Foundation)
 
Rootlinux17: Hypervisors on ARM - Overview and Design Choices by Julien Grall...
Rootlinux17: Hypervisors on ARM - Overview and Design Choices by Julien Grall...Rootlinux17: Hypervisors on ARM - Overview and Design Choices by Julien Grall...
Rootlinux17: Hypervisors on ARM - Overview and Design Choices by Julien Grall...
The Linux Foundation
 
Wpa supplicant introduction
Wpa supplicant introductionWpa supplicant introduction
Wpa supplicant introduction
awkman
 
Debug dpdk process bottleneck & painpoints
Debug dpdk process bottleneck & painpointsDebug dpdk process bottleneck & painpoints
Debug dpdk process bottleneck & painpoints
Vipin Varghese
 
DPDK: Multi Architecture High Performance Packet Processing
DPDK: Multi Architecture High Performance Packet ProcessingDPDK: Multi Architecture High Performance Packet Processing
DPDK: Multi Architecture High Performance Packet Processing
Michelle Holley
 
[ko] Kernel Networking Stack 진입 장벽 허물기
[ko] Kernel Networking Stack 진입 장벽 허물기[ko] Kernel Networking Stack 진입 장벽 허물기
[ko] Kernel Networking Stack 진입 장벽 허물기
Juhee Kang
 
Linux Initialization Process (2)
Linux Initialization Process (2)Linux Initialization Process (2)
Linux Initialization Process (2)
shimosawa
 
Ccnp3 lab 3_4_en
Ccnp3 lab 3_4_enCcnp3 lab 3_4_en
Ccnp3 lab 3_4_en
Omar Herrera
 
ACI MultiPod Config Guide
ACI MultiPod Config GuideACI MultiPod Config Guide
ACI MultiPod Config Guide
Woo Hyung Choi
 
SR-IOV ixgbe Driver Limitations and Improvement
SR-IOV ixgbe Driver Limitations and ImprovementSR-IOV ixgbe Driver Limitations and Improvement
SR-IOV ixgbe Driver Limitations and Improvement
LF Events
 
Faster packet processing in Linux: XDP
Faster packet processing in Linux: XDPFaster packet processing in Linux: XDP
Faster packet processing in Linux: XDP
Daniel T. Lee
 
FreeBSD and Drivers
FreeBSD and DriversFreeBSD and Drivers
FreeBSD and Drivers
Kernel TLV
 
L2 over l3 ecnaspsulations (english)
L2 over l3 ecnaspsulations (english)L2 over l3 ecnaspsulations (english)
L2 over l3 ecnaspsulations (english)Motonori Shindo
 
Linux Internals - Kernel/Core
Linux Internals - Kernel/CoreLinux Internals - Kernel/Core
Linux Internals - Kernel/Core
Shay Cohen
 

What's hot (20)

The Linux Block Layer - Built for Fast Storage
The Linux Block Layer - Built for Fast StorageThe Linux Block Layer - Built for Fast Storage
The Linux Block Layer - Built for Fast Storage
 
Linux dma engine
Linux dma engineLinux dma engine
Linux dma engine
 
DPDK & Layer 4 Packet Processing
DPDK & Layer 4 Packet ProcessingDPDK & Layer 4 Packet Processing
DPDK & Layer 4 Packet Processing
 
Implementation of MAC-level sleep-scheduling
Implementation of MAC-level sleep-schedulingImplementation of MAC-level sleep-scheduling
Implementation of MAC-level sleep-scheduling
 
Embedded linux network device driver development
Embedded linux network device driver developmentEmbedded linux network device driver development
Embedded linux network device driver development
 
Rootlinux17: Hypervisors on ARM - Overview and Design Choices by Julien Grall...
Rootlinux17: Hypervisors on ARM - Overview and Design Choices by Julien Grall...Rootlinux17: Hypervisors on ARM - Overview and Design Choices by Julien Grall...
Rootlinux17: Hypervisors on ARM - Overview and Design Choices by Julien Grall...
 
Wpa supplicant introduction
Wpa supplicant introductionWpa supplicant introduction
Wpa supplicant introduction
 
Debug dpdk process bottleneck & painpoints
Debug dpdk process bottleneck & painpointsDebug dpdk process bottleneck & painpoints
Debug dpdk process bottleneck & painpoints
 
Router commands
Router commandsRouter commands
Router commands
 
DPDK: Multi Architecture High Performance Packet Processing
DPDK: Multi Architecture High Performance Packet ProcessingDPDK: Multi Architecture High Performance Packet Processing
DPDK: Multi Architecture High Performance Packet Processing
 
[ko] Kernel Networking Stack 진입 장벽 허물기
[ko] Kernel Networking Stack 진입 장벽 허물기[ko] Kernel Networking Stack 진입 장벽 허물기
[ko] Kernel Networking Stack 진입 장벽 허물기
 
Linux Initialization Process (2)
Linux Initialization Process (2)Linux Initialization Process (2)
Linux Initialization Process (2)
 
Ccnp3 lab 3_4_en
Ccnp3 lab 3_4_enCcnp3 lab 3_4_en
Ccnp3 lab 3_4_en
 
ACI MultiPod Config Guide
ACI MultiPod Config GuideACI MultiPod Config Guide
ACI MultiPod Config Guide
 
SR-IOV ixgbe Driver Limitations and Improvement
SR-IOV ixgbe Driver Limitations and ImprovementSR-IOV ixgbe Driver Limitations and Improvement
SR-IOV ixgbe Driver Limitations and Improvement
 
Faster packet processing in Linux: XDP
Faster packet processing in Linux: XDPFaster packet processing in Linux: XDP
Faster packet processing in Linux: XDP
 
FreeBSD and Drivers
FreeBSD and DriversFreeBSD and Drivers
FreeBSD and Drivers
 
Asa packet-flow-00
Asa packet-flow-00Asa packet-flow-00
Asa packet-flow-00
 
L2 over l3 ecnaspsulations (english)
L2 over l3 ecnaspsulations (english)L2 over l3 ecnaspsulations (english)
L2 over l3 ecnaspsulations (english)
 
Linux Internals - Kernel/Core
Linux Internals - Kernel/CoreLinux Internals - Kernel/Core
Linux Internals - Kernel/Core
 

Viewers also liked

Microsoft Really Loves Linux – a Virtual Love Story
Microsoft Really Loves Linux – a Virtual Love StoryMicrosoft Really Loves Linux – a Virtual Love Story
Microsoft Really Loves Linux – a Virtual Love Story
Christian Heitkamp
 
OpenContrail, Real Speed: Offloading vRouter
OpenContrail, Real Speed: Offloading vRouterOpenContrail, Real Speed: Offloading vRouter
OpenContrail, Real Speed: Offloading vRouter
Open-NFP
 
Using GPUs to Achieve Massive Parallelism in Java 8
Using GPUs to Achieve Massive Parallelism in Java 8Using GPUs to Achieve Massive Parallelism in Java 8
Using GPUs to Achieve Massive Parallelism in Java 8
Dev_Events
 
Markus Tessmann, InnoGames
Markus Tessmann, InnoGames	Markus Tessmann, InnoGames
Markus Tessmann, InnoGames
White Nights Conference
 
Java garbage collection & GC friendly coding
Java garbage collection  & GC friendly codingJava garbage collection  & GC friendly coding
Java garbage collection & GC friendly coding
Md Ayub Ali Sarker
 
Containers - Portable, repeatable user-oriented application delivery. Build, ...
Containers - Portable, repeatable user-oriented application delivery. Build, ...Containers - Portable, repeatable user-oriented application delivery. Build, ...
Containers - Portable, repeatable user-oriented application delivery. Build, ...
Walid Shaari
 
Accelerating Hadoop, Spark, and Memcached with HPC Technologies
Accelerating Hadoop, Spark, and Memcached with HPC TechnologiesAccelerating Hadoop, Spark, and Memcached with HPC Technologies
Accelerating Hadoop, Spark, and Memcached with HPC Technologies
inside-BigData.com
 
Introduction to OpenCV 3.x (with Java)
Introduction to OpenCV 3.x (with Java)Introduction to OpenCV 3.x (with Java)
Introduction to OpenCV 3.x (with Java)
Luigi De Russis
 
Eclipse JDT Embraces Java 9 – An Insider’s View
Eclipse JDT Embraces Java 9 – An Insider’s ViewEclipse JDT Embraces Java 9 – An Insider’s View
Eclipse JDT Embraces Java 9 – An Insider’s View
Dev_Events
 
Linux Native, HTTP Aware Network Security
Linux Native, HTTP Aware Network SecurityLinux Native, HTTP Aware Network Security
Linux Native, HTTP Aware Network Security
Thomas Graf
 
Pcc
PccPcc
Android operating system
Android operating systemAndroid operating system
Android operating system
Ayush Agarwal
 
How to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your NicheHow to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your Niche
Leslie Samuel
 

Viewers also liked (13)

Microsoft Really Loves Linux – a Virtual Love Story
Microsoft Really Loves Linux – a Virtual Love StoryMicrosoft Really Loves Linux – a Virtual Love Story
Microsoft Really Loves Linux – a Virtual Love Story
 
OpenContrail, Real Speed: Offloading vRouter
OpenContrail, Real Speed: Offloading vRouterOpenContrail, Real Speed: Offloading vRouter
OpenContrail, Real Speed: Offloading vRouter
 
Using GPUs to Achieve Massive Parallelism in Java 8
Using GPUs to Achieve Massive Parallelism in Java 8Using GPUs to Achieve Massive Parallelism in Java 8
Using GPUs to Achieve Massive Parallelism in Java 8
 
Markus Tessmann, InnoGames
Markus Tessmann, InnoGames	Markus Tessmann, InnoGames
Markus Tessmann, InnoGames
 
Java garbage collection & GC friendly coding
Java garbage collection  & GC friendly codingJava garbage collection  & GC friendly coding
Java garbage collection & GC friendly coding
 
Containers - Portable, repeatable user-oriented application delivery. Build, ...
Containers - Portable, repeatable user-oriented application delivery. Build, ...Containers - Portable, repeatable user-oriented application delivery. Build, ...
Containers - Portable, repeatable user-oriented application delivery. Build, ...
 
Accelerating Hadoop, Spark, and Memcached with HPC Technologies
Accelerating Hadoop, Spark, and Memcached with HPC TechnologiesAccelerating Hadoop, Spark, and Memcached with HPC Technologies
Accelerating Hadoop, Spark, and Memcached with HPC Technologies
 
Introduction to OpenCV 3.x (with Java)
Introduction to OpenCV 3.x (with Java)Introduction to OpenCV 3.x (with Java)
Introduction to OpenCV 3.x (with Java)
 
Eclipse JDT Embraces Java 9 – An Insider’s View
Eclipse JDT Embraces Java 9 – An Insider’s ViewEclipse JDT Embraces Java 9 – An Insider’s View
Eclipse JDT Embraces Java 9 – An Insider’s View
 
Linux Native, HTTP Aware Network Security
Linux Native, HTTP Aware Network SecurityLinux Native, HTTP Aware Network Security
Linux Native, HTTP Aware Network Security
 
Pcc
PccPcc
Pcc
 
Android operating system
Android operating systemAndroid operating system
Android operating system
 
How to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your NicheHow to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your Niche
 

Similar to Tutorial WiFi driver code - Opening Nuts and Bolts of Linux WiFi Subsystem

Known basic of NFV Features
Known basic of NFV FeaturesKnown basic of NFV Features
Known basic of NFV Features
Raul Leite
 
26.1.7 lab snort and firewall rules
26.1.7 lab   snort and firewall rules26.1.7 lab   snort and firewall rules
26.1.7 lab snort and firewall rules
Freddy Buenaño
 
Linux hpc-cluster-setup-guide
Linux hpc-cluster-setup-guideLinux hpc-cluster-setup-guide
Linux hpc-cluster-setup-guidejasembo
 
Advanced Troublesshooting Nexus 7K.pdf
Advanced Troublesshooting Nexus 7K.pdfAdvanced Troublesshooting Nexus 7K.pdf
Advanced Troublesshooting Nexus 7K.pdf
JeanChristian12
 
Project report,nowrin
Project report,nowrinProject report,nowrin
Project report,nowrin
NowrinJahanSiam
 
Configuring wifi in open embedded builds
Configuring wifi in open embedded buildsConfiguring wifi in open embedded builds
Configuring wifi in open embedded builds
Mender.io
 
Banog meetup August 30th, network device property as code
Banog meetup August 30th, network device property as codeBanog meetup August 30th, network device property as code
Banog meetup August 30th, network device property as code
Damien Garros
 
9Tuts.Com New CCNA 200-120 New CCNA New Questions 2
9Tuts.Com New CCNA 200-120 New CCNA   New Questions 29Tuts.Com New CCNA 200-120 New CCNA   New Questions 2
9Tuts.Com New CCNA 200-120 New CCNA New Questions 2
Lori Head
 
The Next Step of OpenStack Evolution for NFV Deployments
The Next Step ofOpenStack Evolution for NFV DeploymentsThe Next Step ofOpenStack Evolution for NFV Deployments
The Next Step of OpenStack Evolution for NFV Deployments
Dirk Kutscher
 
slides-frnog34.pdf
slides-frnog34.pdfslides-frnog34.pdf
slides-frnog34.pdf
jnbrains
 
BRKRST-3066 - Troubleshooting Nexus 7000 (2013 Melbourne) - 2 Hours.pdf
BRKRST-3066 - Troubleshooting Nexus 7000 (2013 Melbourne) - 2 Hours.pdfBRKRST-3066 - Troubleshooting Nexus 7000 (2013 Melbourne) - 2 Hours.pdf
BRKRST-3066 - Troubleshooting Nexus 7000 (2013 Melbourne) - 2 Hours.pdf
aaajjj4
 
Reverse engineering Swisscom's Centro Grande Modem
Reverse engineering Swisscom's Centro Grande ModemReverse engineering Swisscom's Centro Grande Modem
Reverse engineering Swisscom's Centro Grande Modem
Cyber Security Alliance
 
CENTRAL MANAGEMENT OF NETWORK AND CALL SERVICES
CENTRAL MANAGEMENT OF NETWORK AND CALL SERVICESCENTRAL MANAGEMENT OF NETWORK AND CALL SERVICES
CENTRAL MANAGEMENT OF NETWORK AND CALL SERVICES
Nazmul Hossain Rakib
 
Computer technicians-quick-reference-guide
Computer technicians-quick-reference-guideComputer technicians-quick-reference-guide
Computer technicians-quick-reference-guide
Shathees Rao
 
Virtualization & Network Connectivity
Virtualization & Network Connectivity Virtualization & Network Connectivity
Virtualization & Network Connectivity
itplant
 
Practice and challenges from building IaaS
Practice and challenges from building IaaSPractice and challenges from building IaaS
Practice and challenges from building IaaS
Shawn Zhu
 
82599 sriov vm configuration notes
82599 sriov vm configuration notes82599 sriov vm configuration notes
82599 sriov vm configuration notes
Ryan Aydelott
 
2015_01 - Networking Session - SPHMMC ICT workshop
2015_01 - Networking Session - SPHMMC ICT workshop2015_01 - Networking Session - SPHMMC ICT workshop
2015_01 - Networking Session - SPHMMC ICT workshop
Kathleen Ludewig Omollo
 
Management configuration
Management configurationManagement configuration
Management configuration
mckan1974
 
Manual linksys router_rv082
Manual linksys router_rv082Manual linksys router_rv082
Manual linksys router_rv082
Edgar Cañizalez
 

Similar to Tutorial WiFi driver code - Opening Nuts and Bolts of Linux WiFi Subsystem (20)

Known basic of NFV Features
Known basic of NFV FeaturesKnown basic of NFV Features
Known basic of NFV Features
 
26.1.7 lab snort and firewall rules
26.1.7 lab   snort and firewall rules26.1.7 lab   snort and firewall rules
26.1.7 lab snort and firewall rules
 
Linux hpc-cluster-setup-guide
Linux hpc-cluster-setup-guideLinux hpc-cluster-setup-guide
Linux hpc-cluster-setup-guide
 
Advanced Troublesshooting Nexus 7K.pdf
Advanced Troublesshooting Nexus 7K.pdfAdvanced Troublesshooting Nexus 7K.pdf
Advanced Troublesshooting Nexus 7K.pdf
 
Project report,nowrin
Project report,nowrinProject report,nowrin
Project report,nowrin
 
Configuring wifi in open embedded builds
Configuring wifi in open embedded buildsConfiguring wifi in open embedded builds
Configuring wifi in open embedded builds
 
Banog meetup August 30th, network device property as code
Banog meetup August 30th, network device property as codeBanog meetup August 30th, network device property as code
Banog meetup August 30th, network device property as code
 
9Tuts.Com New CCNA 200-120 New CCNA New Questions 2
9Tuts.Com New CCNA 200-120 New CCNA   New Questions 29Tuts.Com New CCNA 200-120 New CCNA   New Questions 2
9Tuts.Com New CCNA 200-120 New CCNA New Questions 2
 
The Next Step of OpenStack Evolution for NFV Deployments
The Next Step ofOpenStack Evolution for NFV DeploymentsThe Next Step ofOpenStack Evolution for NFV Deployments
The Next Step of OpenStack Evolution for NFV Deployments
 
slides-frnog34.pdf
slides-frnog34.pdfslides-frnog34.pdf
slides-frnog34.pdf
 
BRKRST-3066 - Troubleshooting Nexus 7000 (2013 Melbourne) - 2 Hours.pdf
BRKRST-3066 - Troubleshooting Nexus 7000 (2013 Melbourne) - 2 Hours.pdfBRKRST-3066 - Troubleshooting Nexus 7000 (2013 Melbourne) - 2 Hours.pdf
BRKRST-3066 - Troubleshooting Nexus 7000 (2013 Melbourne) - 2 Hours.pdf
 
Reverse engineering Swisscom's Centro Grande Modem
Reverse engineering Swisscom's Centro Grande ModemReverse engineering Swisscom's Centro Grande Modem
Reverse engineering Swisscom's Centro Grande Modem
 
CENTRAL MANAGEMENT OF NETWORK AND CALL SERVICES
CENTRAL MANAGEMENT OF NETWORK AND CALL SERVICESCENTRAL MANAGEMENT OF NETWORK AND CALL SERVICES
CENTRAL MANAGEMENT OF NETWORK AND CALL SERVICES
 
Computer technicians-quick-reference-guide
Computer technicians-quick-reference-guideComputer technicians-quick-reference-guide
Computer technicians-quick-reference-guide
 
Virtualization & Network Connectivity
Virtualization & Network Connectivity Virtualization & Network Connectivity
Virtualization & Network Connectivity
 
Practice and challenges from building IaaS
Practice and challenges from building IaaSPractice and challenges from building IaaS
Practice and challenges from building IaaS
 
82599 sriov vm configuration notes
82599 sriov vm configuration notes82599 sriov vm configuration notes
82599 sriov vm configuration notes
 
2015_01 - Networking Session - SPHMMC ICT workshop
2015_01 - Networking Session - SPHMMC ICT workshop2015_01 - Networking Session - SPHMMC ICT workshop
2015_01 - Networking Session - SPHMMC ICT workshop
 
Management configuration
Management configurationManagement configuration
Management configuration
 
Manual linksys router_rv082
Manual linksys router_rv082Manual linksys router_rv082
Manual linksys router_rv082
 

Recently uploaded

How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
AzmatAli747758
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
Celine George
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
EduSkills OECD
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
rosedainty
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
PedroFerreira53928
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 

Recently uploaded (20)

How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 

Tutorial WiFi driver code - Opening Nuts and Bolts of Linux WiFi Subsystem

  • 1. Opening Nuts and Bolts of Linux WiFi Subsystem Dheryta Jaisinghani
  • 2. Why do we need to understand this? I wonder ● What happens in the background (in the Operating System) when I connect to WiFi? ● How does a packet travels all the way from my application to kernel to air and back? ● How can I modify the code to try my own algorithms? 2
  • 3. Structure of this talk ● Linux WiFi Subsystem - Bird’s Eye View ● Types of WiFi drivers ● Working with code - Source, Compilation, Kernel Module Insertion ● Flow of code - where to make changes ● Important commands - events, connection establishment, information on card and modules, logging ● Important pointers - Tutorials 3
  • 5. What does MAC - Medium Access Control do? ● MLME - MAC SubLayer Management Entity ○ Authenticate ○ Deauthenticate ○ Associate ○ Disassociate ○ Reassociate ○ Beacon ○ Probe 5
  • 6. Know about your WiFi card 6
  • 7. 7 sudo lshw -C network
  • 10. Types of WiFi Devices Full MAC: MAC in hardware [1] https://wireless.wiki.kernel.org/en/developers/documentation/glossary Soft MAC: MAC in software 10
  • 12. Linux WiFi Subsystem - Bird’s Eye View [1] D. Jaisinghani, -, S. Kaul, and S. Roy. Sniffer-based Inference of the Causes of Active Scanning in WiFi Networks. NCC 2017 12
  • 13. What happens when a WiFi card is plugged in? ● Device drivers load order - ○ cfg80211 -> mac80211 -> ath9k ● LibNL, Wireless Information ○ /usr/include/linux/nl80211.h ○ /proc/net/wireless ○ /proc/net/dev ● Events ○ WiFi connection establishment - ■ Associate ■ Authenticate ○ DHCP ■ Network - IP ● Terminal command - tail -f /var/log/syslog or dmesg (Look for keywords - wpa_supplicant, network manager, kernel, dhclient) [1] http://moi.vonos.net/linux/wireless-stack/ 13
  • 15. 1. Open 2 terminals - terminal 1 and terminal 2 2. In terminal 1 - sudo tail -f /var/log/syslog 3. In terminal 2 - sudo rmmod ath9k 4. Notice the messages in terminal 1 5. In terminal 2 - sudo modprobe ath9k 6. Notice the messages in terminal 2 15
  • 16. Feb 25 12:04:08 Laptop kernel: [38508.139858] ath: phy2: ASPM enabled: 0x42 Feb 25 12:04:08 Laptop kernel: [38508.140435] ieee80211 phy2: Selected rate control algorithm 'minstrel_ht' Feb 25 12:04:08 Laptop NetworkManager[952]: <info> (wlan0): using nl80211 for WiFi device control Feb 25 12:04:08 Laptop NetworkManager[952]: <info> (wlan0): new 802.11 WiFi device (driver: 'ath9k' ifindex: 6) Feb 25 12:04:08 Laptop NetworkManager[952]: <info> (wlan0): using nl80211 for WiFi device control Feb 25 12:04:08 Laptop NetworkManager[952]: <info> (wlan0): new 802.11 WiFi device (driver: 'ath9k' ifindex: 6) Feb 25 12:04:08 Laptop NetworkManager[952]: <info> NetworkManager state is now DISCONNECTED Feb 25 12:04:09 Laptop wpa_supplicant[5068]: wlan0: CTRL-EVENT-SCAN-STARTED Feb 25 12:04:12 Laptop NetworkManager[952]: <info> Auto-activating connection 'FACULTY-STAFF-N'. Feb 25 12:04:12 Laptop NetworkManager[952]: <info> (wlan0): device state change: config -> need-auth (reason 'none') [50 60 0] Feb 25 12:04:12 Laptop wpa_supplicant[5068]: wlan0: SME: Trying to authenticate with c4:0a:cb:5c:07:0a (SSID='FACULTY-STAFF-N' freq=5280 MHz) Feb 25 12:04:12 Laptop NetworkManager[952]: <info> (wlan0): supplicant interface state: inactive -> authenticating 16
  • 17. Feb 25 12:04:16 Laptop wpa_supplicant[5068]: wlan0: Trying to associate with c4:0a:cb:5c:07:0a (SSID='FACULTY-STAFF-N' freq=5280 MHz) Feb 25 12:04:16 Laptop kernel: [38515.397527] wlan0: send auth to c4:0a:cb:5c:07:0a (try 2/3) Feb 25 12:04:16 Laptop kernel: [38515.398891] wlan0: authenticated Feb 25 12:04:16 Laptop kernel: [38515.401031] wlan0: associate with c4:0a:cb:5c:07:0a (try 1/3) Feb 25 12:04:16 Laptop kernel: [38515.402612] wlan0: RX AssocResp from c4:0a:cb:5c:07:0a (capab=0x11 status=0 aid=2) Feb 25 12:04:16 Laptop kernel: [38515.402686] wlan0: associated Feb 25 12:04:16 Laptop NetworkManager[952]: <info> (wlan0): device state change: config -> ip-config (reason 'none') [50 70 0] Feb 25 12:04:16 Laptop NetworkManager[952]: <info> Activation (wlan0) Beginning DHCPv4 transaction (timeout in 45 seconds) Feb 25 12:04:16 Laptop NetworkManager[952]: <info> dhclient started with pid 6172 Feb 25 12:04:16 Laptop NetworkManager[952]: <info> address 192.168.X.X Feb 25 12:04:16 Laptop NetworkManager[952]: <info> prefix 20 (255.255.240.0) Feb 25 12:04:16 Laptop NetworkManager[952]: <info> gateway 192.168.X.X Feb 25 12:04:16 Laptop NetworkManager[952]: <info> nameserver '192.168.X.X' Feb 25 12:04:16 Laptop NetworkManager[952]: <info> domain name 'iiitd.edu.in' 17
  • 18. watch -n1 "cat /proc/net/wireless" watch -n1 "cat /proc/net/dev" 18
  • 19. Flow of Packets in an Operating System ● Data vs Control Path ● Transmit vs Receive Path 19
  • 20. Data Application System Call Sockets Network Protocols Net_dev core Driver Network Application nl80211 cfg80211 mac80211 Data Path Control Path [1] https://www.linux.com/blog/linux-wireless-networking-short-walk 20
  • 22. net/wireless/handlers/wireless/nl80211.c (struct genl_opsnl80211_ops) nl80211 cfg80211 mac80211 ath9k net/wireless (Configurations) - Struct cfg80211_ops /net/mac80211 (Rate Control, MLME-Authenticate, Reassociate, Deauthenticate, Associate, Disassociate, Beacon , Probe, PM, Scan, Retries, ACK Handling, etc) - struct ieee80211_ops drivers/net/wireless/ath/ath9k (Transmit and Receive) 22
  • 23. How is a Packet Received? Main.c: Interrupt from hardware to ath9k: irqreturn_t ath_isr Recv.c : ath_rx_tasklet () rx.c : ieee80211_rx () -> ieee80211_prepare_and_rx_handle() -> ieee80211_rx_handlers() -> ieee80211_deliver_skb() - go up or down to air -> ● netif_receive_skb() (rx.c) - up ● dev_queue_xmit() - send to air [1] http://www.campsmur.cat/files/mac80211_intro.pdf 23
  • 24. How is a packet transmitted? Kernel to interface (virtual) Tx.c - ieee80211_subif_start_xmit() Tx.c - ieee80211_xmit() Tx.c - ieee80211_tx() <ieee80211_ops> main.c - ath9k_tx() - struct ath_tx (ath9k.h) - 10 TX queues xmit.c - ath_tx_start () xmit.c - ath_tx_txqaddbuf () mac.c - ath9k_hw_txstart() Writes register in hardware to perform transmission [1] http://www.campsmur.cat/files/mac80211_intro.pdf 24
  • 25. Debugging Options Debug Ath9k 1. sudo make menuconfig - Enable debug options as specified in the above mentioned link 2. sudo make 3. sudo make install with flags 4. modprobe ath9k debug=0x00000200 (or) modprobe ath9k_htc debug=0x00000200 5. ATH_DBG_ANY = 0xffffffff 6. tail -f /var/log/syslog Debug mac80211/cfg80211 1. sudo modprobe mac80211 debug=0xffffffff 2. sudo trace-cmd record -e mac80211 3. trace-cmd report -i trace.dat | grep scan 25
  • 27. sudo watch -n1 “cat /sys/kernel/debug/ieee80211/phy4/ath9k/recv” 27
  • 28. sudo watch -n1 “cat /sys/kernel/debug/ieee80211/phy4/ath9k/xmit” 28
  • 29. Important and Useful Commands ● Wireless Events (scan, authentication etc) - sudo iw event -t ● Connection Stats (inactive time, rx/tx bytes/packets, signal, bitrate etc) - sudo iw dev wlan0 station dump ● Regular Monitoring - watch -n1 “<command>” ● lshw -C network, lsusb, lspci ● Debug Messages - tail -f /var/log/syslog, dmesg 29
  • 30. Important URLs ● All about Wireless Kernel: https://wireless.wiki.kernel.org/en/users ● Tracing the code paths: http://blog.cerowrt.org/post/wifi_software_paths/ ● Networking Stack Programming: http://www.geeksofpune.in/files/GEEP-NetworkingSt ack-28may14.pdf ● Download backports: ○ https://backports.wiki.kernel.org/index.php/Main_Pag e ○ http://drvbp1.linux-foundation.org/~mcgrof/rel-html/b ackports/ ● Debugging backports: https://wireless.wiki.kernel.org/en/users/drivers/ath 9k/debug 30
  • 31. Questions? ● Webpage: www.dheryta.co.in ● E-Mail: dherytaj@iiitd.ac.in 31
  • 32. Abstract Title: Opening Nuts and Bolts of Linux WiFi Subsystem While we understand the complex interplay of OSI layers, in theory, in practice understanding their implementation is a non-trivial task. The implementation details that enables a network interface card to communicate with its peers are oblivious to the end-users. Naive developers such as undergraduate and graduate students often find it hard to find relevant tutorials that enable them to understand these implementation details. The aim of this talk is to provide an overview of WiFi Subsystem implemented in the Linux operating system. Specifically, this talk will explain the sequence of events that occur from application layer till physical layer when a connection is established over WiFi. After this talk, the audience will understand -- (1) the bird's eye view of Linux WiFi Subsystem, (2) what happens in an operating system when a WiFi card is plugged-in, (3) how is a packet received/transmitted from physical layer to operating system kernel and vice-versa, (4) brief overview of code structure of open-source drivers, and lastly (5) important pointers to kickstart driver code modifications. Duration: 30-40 minutes Add-ons: Minimal Demonstration 32