Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

Impelemented deactivate function and disconnect command. #58

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Impelemented deactivate function and disconnect command. #58

wants to merge 2 commits into from

Conversation

Jonnycake
Copy link

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

@rockymeza
Copy link
Owner

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.

@@ -108,6 +109,9 @@ def autoconnect_command(args):
else:
assert False, "Couldn't find any schemes that are currently available."

def disconnect_command(args):
subprocess.call(['dhclient', '-r', args.interface], stderr=subprocess.STDOUT)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you use /sbin/dhclient here too?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice not to repeat this code twice, but as there is no way to fetch the currently activated scheme, I'm ok with it.

What do you think?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"can you use /sbin/dhclient here too?"
Yup, I actually meant to, but my brain must not have been working yet this morning.

"It would be nice not to repeat this code twice..."
Yeah, I was thinking that myself, but like you said there's no way to get the current scheme, so if you're okay with it I am at least until if/when such a function becomes available.

@rockymeza rockymeza mentioned this pull request Jan 26, 2015
@rockymeza
Copy link
Owner

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
Copy link
Author

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
Copy link
Owner

I'm on debian, what are you on?

-rocky

On Mon, Jan 26, 2015 at 7:33 AM, Jon Stockton [email protected]
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
#58 (comment).

@Jonnycake
Copy link
Author

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
Copy link
Owner

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 [email protected]
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
#58 (comment).

@Jonnycake
Copy link
Author

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants