rockymeza / wifi

[unmaintained] WiFi tools for linux
http://pypi.python.org/pypi/wifi
BSD 2-Clause "Simplified" License
305 stars 151 forks source link

Impelemented deactivate function and disconnect command. #58

Open Jonnycake opened 9 years ago

Jonnycake commented 9 years ago

This won't do anything if NetworkManager (or another network management daemon) is running, but it works otherwise.

rockymeza commented 9 years ago

Hi @Jonnycake,

Thanks for the pull request. I just have a couple comments on the code, and then I think this is good to go.

rockymeza commented 9 years ago

Ok, so I was trying it out and I'm still not having anything. I'm not running NetworkManager or wicd. But I don't think that maybe wpa_supplicant is related in someway. When I run ifup, it turns on wpa_supplicant. Do you wpa_supplicant on your machine?

Jonnycake commented 9 years ago

Yeah I have wpa_supplicant on my machine as well and it doesn't seem to be affecting it. What distribution are you using? Maybe there's another daemon that's mucking things up.

For clarification: normally my machine runs NetworkManager, but wpa_supplicant is still used and is currently running.

rockymeza commented 9 years ago

I'm on debian, what are you on?

-rocky

On Mon, Jan 26, 2015 at 7:33 AM, Jon Stockton notifications@github.com wrote:

Yeah I have wpa_supplicant on my machine as well and it doesn't seem to be affecting it. What distribution are you using? Maybe there's another daemon that's mucking things up.

— Reply to this email directly or view it on GitHub https://github.com/rockymeza/wifi/pull/58#issuecomment-71468855.

Jonnycake commented 9 years ago

Ubuntu, I'l try under debian, but I don't see that it should be any different. Run this command: dpkg -l | grep "wifi\|wireless\|net" and ps -Af | grep "wlan\|net" and see if there's any packages/processes installed with components that could have the same effect. There has to be something else running. I'll try it on a test debian box sometime tomorrow.

rockymeza commented 9 years ago

I get:

root 29 2 0 Jan05 ? 00:00:00 [netns] root 28407 1 0 19:47 ? 00:00:00 /sbin/wpa_supplicant -s -B -P /var/run/wpa_supplicant.wlan0.pid -i wlan0 -D nl80211,wext -C /var/run/wpa_supplicant root 28448 1 0 19:47 ? 00:00:00 dhclient -v -pf /run/dhclient.wlan0.pid -lf /var/lib/dhcp/dhclient.wlan0.leases wlan0 rocky 29319 29223 0 20:16 pts/18 00:00:00 grep --color=auto wlan|net

What do you have?

-rocky

On Sun, Feb 1, 2015 at 3:39 PM, Jon Stockton notifications@github.com wrote:

Ubuntu, I'l try under debian, but I don't see that it should be any different. Run this command: dpkg -l | grep "wifi|wireless|net" and ps -Af | grep "wlan|net" and see if there's any packages/processes installed with components that could have the same effect. There has to be something else running. I'll try it on a test debian box sometime tomorrow.

— Reply to this email directly or view it on GitHub https://github.com/rockymeza/wifi/pull/58#issuecomment-72388870.

Jonnycake commented 9 years ago

root 1084 1 0 Jan31 ? 00:00:00 /usr/sbin/xinetd -dontfork -pidfile /var/run/xinetd.pid -stayalive -inetd_compat -inetd_ipv6 root 1946 896 0 Jan31 ? 00:00:00 /sbin/dhclient -d -sf /usr/lib/NetworkManager/nm-dhcp-client.action -pf /run/sendsigs.omit.d/network-manager.dhclient-wlan0.pid -lf /var/lib/NetworkManager/dhclient-cf300b1b-1401-4b50-8a76-db0a64651cb7-wlan0.lease -cf /var/lib/NetworkManager/dhclient-wlan0.conf wlan0 nobody 1949 896 0 Jan31 ? 00:00:03 /usr/sbin/dnsmasq --no-resolv --keep-in-foreground --no-hosts --bind-interfaces --pid-file=/run/sendsigs.omit.d/network-manager.dnsmasq.pid --listen-address=127.0.1.1 --conf-file=/var/run/NetworkManager/dnsmasq.conf --cache-size=0 --proxy-dnssec --enable-dbus=org.freedesktop.NetworkManager.dnsmasq --conf-dir=/etc/NetworkManager/dnsmasq.d root 15885 1 0 Feb01 ? 00:00:00 dhclient -1 -v -pf /run/dhclient.wlan0.pid -lf /var/lib/dhcp/dhclient.wlan0.leases wlan0 jonathan 18996 18983 0 03:18 pts/1 00:00:00 grep --color=auto wlan|net

Was going to say that it must've been the wpa_supplicant process, but that's wrong - I found it running on mine as well.

Try killing and restarting the dhclient proceess after stopping network manager. See here: http://www.cyberciti.biz/faq/howto-linux-renew-dhcp-client-ip-address/#comment-56385