Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Fix for automatic gateway interface IP calculation #736

Merged
merged 1 commit into from Mar 29, 2013

Conversation

Projects
None yet
3 participants
Contributor

rnavarro commented Mar 29, 2013

  • Previously this would return the ip address of the default gateway NOT the interface
@rnavarro rnavarro Fixed automatic ip address calculation
* Previously this would return the ip address of the default gateway NOT the interface
228abb5
Contributor

rnavarro commented Mar 29, 2013

This is my first pull request ever....so if I'm doing it wrong let me know 😲

Owner

primalmotion commented Mar 29, 2013

Seems good. @CyrilPeponnet I guess you changed that thing in the first place, can check it out?

Even if work for a networking company, I hate networking :)

Member

CyrilPeponnet commented Mar 29, 2013

I never touch this part, seems like magic for me :)

I don't know how it works, but it works I test it by hand... previous code was returning 0.0.0.0, this one the ip address of the interface.

found the code here : http://thiagodefreitas.com/blog/2010/11/19/ip-netmask-gateway-python-unix/
so should be ok :)

@primalmotion I found your first implementation on the first result on google pointed to stack overflow :) are you sure you are working for a network company :p

Contributor

rnavarro commented Mar 29, 2013

Glad to hear i'm not the only one this is black magic for haha....

I generally tend to use netifaces when doing any python networking stuff...but having an external dependency requirement for my first pull request seemed a bit much 😃

Owner

primalmotion commented Mar 29, 2013

Have you tried this on several Linux distro?

Contributor

rnavarro commented Mar 29, 2013

I tested this on the distros I have immediate access to:

Ubuntu server 12.04 LTS
Ubuntu server 12.10
Debian Squeeze
CentOS 6

However these calls are all very low level, using the standard ioctl() interface, making this more kernel dependent than OS dependent. All kernels that support virtualization should definitely be recent enough to support this.

Member

CyrilPeponnet commented Mar 29, 2013

Works on sid and archlinux too

@primalmotion primalmotion added a commit that referenced this pull request Mar 29, 2013

@primalmotion primalmotion Merge pull request #736 from rnavarro/master
Fix for automatic gateway interface IP calculation
8a88525

@primalmotion primalmotion merged commit 8a88525 into ArchipelProject:master Mar 29, 2013

Owner

primalmotion commented Mar 29, 2013

Merged. Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment