Debugging

If you couldn't resolve your problem using the Troubleshooting guide, and feel like spending a little time on trying to get it to work on your phone model, please help out by following this guide.

Strange errors when Barnacle is starting

You can start Barnacle Wifi Tether without the user interface via adb or terminal emulator app. For the adb tool, get the Android SDK.

  1. Connect your phone via USB and run

    adb shell
    
  2. su cd /data/data/net.szym.barnacle/files # now, we'll try to start barnacle manually ./setup sh ./wifi load # you should see "wifi driver loaded" ./wifi config

    ./dhcp

    if it does not report errors, then press Ctrl-C to stop DHCP server

    ./nat

    if it does not report errors, then do Ctrl-C to stop the NAT engine

    ./wifi assoc

    it should print:

    wpa_supplicant started wpa_supplicant connected OK tiwlan0 XX:XX:XX:XX:XX:XX

    Stop it with Ctrl-D.

    if all this steps work, then let's try the run script

    rm nat_ctrl ./run

    it should print out four lines:

    wifi driver loaded wpa_supplicant started wpa_supplicant connected OK tiwlan0 XX:XX:XX:XX:XX:XX

    It is now running barnacle, but without the GUI. Go ahead and test

    it with your laptop. Press Enter to associate. You can stop it at any time with Ctrl-D at which point it will print: [1] Terminated ./dhcp [2] Terminated ./nat

If it does not end with OK XXXX then you should check the logcat. Simply execute

logcat

and look for entries with tag barnacle, WifiHW and wpa_supplicant E-mail both the output from brncl and the relevant logcat to barnacle @ this domain.

Barnacle starts with no problems but laptop never sees the network

First check if you need to disable wpa_supplicant. Then press Associate to ensure Barnacle is beaconing the ad-hoc network and initiate a re-scan on your laptop.

My laptop sees the network, but it never gets an

IP via DHCP"]

It's most likely a problem with the ad-hoc network, but you bypass the DHCP, by configuring your laptop with a static IP configuration. (Make sure to disable Access Control first)

IP 192.168.5.100
netmask 255.255.255.0
gateway 192.168.5.1

If your laptop needs a static DNS server address as well, you will need to look it up on your phone by running:

 getprop net.dns1

 getprop net.dns2

via either Terminal Emulator or adb shell.

Afterwards, try pinging the phone:

ping 192.168.5.1

If this works, but the DHCP does not, run "logcat" and look for entries with tag barnacle. Specifically, starting with DHCP. They should give us insight into why the DHCP server does not work properly.

Laptop associates and gets valid IP (192.168.5.1XX), but Internet doesn't

work

Check if the connection between the laptop and the phone is working properly by executing on your laptop's command line:

ping 192.168.5.1

If this works, then that might be an undiscovered bug in Barnacle's NAT code, but could be caused by some countermeasures employed by your wireless provider. Try changing the First Port in Barnacle's Settings - Advanced - NAT. Pick something in the range 1024 - 65000.

Advanced diagnostics using tcpdump

tcpdump is a great tool for low-level network diagnostics. It uses the Pcap library (also used in WinDUMP or Wireshark) to capture packets directly from the network interface (bypassing the network stack in the kernel).

Tcpdump has been ported to Android and is available as an AOSP project. For your convenience, it's also available here.

  1. unzip the binary and push it to the phone (using adb push or putting it on the SD card).
  2. navigate to the directory you placed it in
  3. make it executable:

    chmod 755 tcpdump
    
  4. obtain root shell using su (tcpdump needs it to access the raw packet interface

  5. run
    ./tcpdump -i [interface]
    

where interface is either your wifi interface (tiwlan0, wlan0 or eth0) or your mobile data interface (ppp0, pnp0, rmnet0, etc.). Barnacle automatically detects the interface names and you can find them in Settings - Interfaces.

  1. stop tcpdump using Ctrl+C.

Optionally you can pass -c packetcount to stop capture after some number of packets has been captured. There might be a lot of packets coming on the mobile data interface, so you can apply filtering. Unless you changed Barnacle's NAT settings, you can do

./tcpdump -i [mobile-interface] 'portrange 32000-32300'

This will only capture the packets that Barnacle translates. Note, tcpdump will capture both outgoing and incoming packets. The output is:

[timestamp] IP [source address.port] > [destination address.port]: [flags] [details]
blog comments powered by Disqus