[Galaxy Tab 3 7.0 Android Development] cybertheque:
just to document ongoing experiments:

(successful connection from Windows client but no packet forwarding to the cellular radio i/f - no nat)

'rmmod' in busybox won't work unless /lib/modules/3.4.0-svn21

exists (it can be empty, just exists)

mount -oremount,rw /

mkdir /lib

mkdir /lib/modules

mkdir /lib/modules/3.4.0-svn21

remove the running wl module

'rmmod wlan' removes prima wl module

'insmod prima_wlan.ko' run in /system/lib/modules installs

the module. be sure that /data/misc/wifi/sockets directory

exists. mkdir -m 770 /data/misc/wifi/sockets

/system/bin/chown wifi:wifi sockets

sockets are created on starting wifi in 'settings'

- 'svc wifi enable' also works

- sockets are deleted with 'svc wifi disable'

or turning off wifi in 'settings'

root@lt02ltespr:/data/misc/wifi # ls -al sockets

ls -al sockets

srwxrwx--- wifi wifi 2016-08-14 18:22 p2p0

srwxrwx--- wifi wifi 2016-08-14 18:22 wlan0

srw-rw---- system wifi 2016-08-14 18:22 wpa_ctrl_762-1

srw-rw---- system wifi 2016-08-14 18:22 wpa_ctrl_762-2

# svc wifi disable

- removes sockets

# cat hostapd.conf

interface=wlan0

driver=nl80211

ctrl_interface=/data/misc/wifi/sockets

ssid=tab3

channel=3

hw_mode=g

# logcat | grep hostapd

# hostapd ./hostapd.conf (in separate shell session)

E/hostapd (10845): Configuration file: ./hostapd.conf

I/hostapd (10845): rfkill: Cannot open RFKILL control device

I/hostapd (10845): nl80211: Set freq 2422 (ht_enabled=0, vht_enabled=0, bandwidt

h=20 MHz, cf1=2422 MHz, cf2=0 MHz)

E/hostapd (10845): Using interface wlan0 with hwaddr 00.89.FF and ""

E/hostapd (10845): hostapd_setup_bss: max_num_sta = 2007

- connection attempt from 'eb3':

I/hostapd (10845): AP-STA-CONNECTED 00.10.81

- disconnect done from 'eb3':

I/hostapd (10845): AP-STA-DISCONNECTED 00.10.81

# ifconfig wlan0 192.168.0.10

# stty intr "^E"

- type verbatim - not CTRL+E (necessary when using adb to prevent exit to

host shell)

# sysctl -w net.ipv4.ip_forward=1

# /system/bin/dnsmasq --no-resolv --dhcp-range=192.168.0.5,192.168.0.29,1h --pid-file=/data/misc/wifi/sockets/dnsmasq.pid

# logcat | grep dnsmasq

I/dnsmasq (12291): started, version 2.62 cachesize 150

I/dnsmasq (12291): compile time options: IPv6 GNU-getopt no-DBus no-i18n no-IDN

DHCP DHCPv6 no-scripts no-TFTP no-conntrack

W/dnsmasq (12291): warning: no upstream servers configured

I/dnsmasq (12291): DHCP, IP range 192.168.0.5 -- 192.168.0.29, lease time 1h

I/dnsmasq (12291): read /etc/hosts - 1 addresses

I/dnsmasq (12291): DHCPDISCOVER(wlan0) 00:16:ea:6a:63:46

I/dnsmasq (12291): DHCPOFFER(wlan0) 192.168.0.10 00:16:ea:6a:63:46

I/dnsmasq (12291): DHCPREQUEST(wlan0) 192.168.0.10 00:16:ea:6a:63:46

I/dnsmasq (12291): DHCPACK(wlan0) 192.168.0.10 00:16:ea:6a:63:46 elitebook3

I/dnsmasq (12291): DHCPINFORM(wlan0) 192.168.0.10 00:16:ea:6a:63:46

I/dnsmasq (12291): DHCPACK(wlan0) 192.168.0.10 00:16:ea:6a:63:46 elitebook3

# ping 192.168.0.11

PING 192.168.0.11 (192.168.0.11): 56 data bytes

64 bytes from 192.168.0.11: seq=0 ttl=128 time=3.846 ms

64 bytes from 192.168.0.11: seq=1 ttl=128 time=3.815 ms

64 bytes from 192.168.0.11: seq=2 ttl=128 time=3.877 ms

64 bytes from 192.168.0.11: seq=3 ttl=128 time=3.815 ms

(on windows client 192.168.0.11):

ping 192.168.0.10

request timed out

# iptables -t nat --list-rules

(iptables -t nat -S)

-P PREROUTING ACCEPT

-P INPUT ACCEPT

-P OUTPUT ACCEPT

-P POSTROUTING ACCEPT

-N natctrl_nat_POSTROUTING

-N natctrl_nat_PREROUTING

-N oem_nat_pre

-N st_nat_POSTROUTING

-A PREROUTING -j oem_nat_pre

-A PREROUTING -j natctrl_nat_PREROUTING

-A POSTROUTING -j natctrl_nat_POSTROUTING

-A POSTROUTING -j st_nat_POSTROUTING

-A POSTROUTING -o rmnet0 -j MASQUERADE

# iptables -t nat --append POSTROUTING --out-interface rmnet0 -j MASQUERADE

# iptables --append FORWARD --in-interface wlan0 -j ACCEPT

# iptables -L | grep Chain

Chain INPUT (policy ACCEPT)

Chain FORWARD (policy ACCEPT)

Chain OUTPUT (policy ACCEPT)

Chain bw_FORWARD (1 references)

Chain bw_INPUT (1 references)

Chain bw_OUTPUT (1 references)

Chain bw_costly_rmnet0 (2 references)

Chain bw_costly_shared (0 references)

Chain bw_happy_box (0 references)

Chain bw_penalty_box (2 references)

Chain fw_FORWARD (1 references)

Chain fw_INPUT (1 references)

Chain fw_OUTPUT (1 references)

Chain natctrl_FORWARD (1 references)

Chain natctrl_tether_counters (0 references)

Chain oem_fwd (1 references)

Chain oem_out (1 references)

Chain st_filter_OUTPUT (1 references)

Very little online discussion about Android's use of iptables