Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net: InterfaceAddrs returns peer address on point-to-point link #4839

Closed
wheelcomplex opened this issue Feb 18, 2013 · 9 comments
Closed

net: InterfaceAddrs returns peer address on point-to-point link #4839

wheelcomplex opened this issue Feb 18, 2013 · 9 comments
Milestone

Comments

@wheelcomplex
Copy link
Contributor

Before filing a bug, please check whether it has been fixed since the
latest release. Search the issue tracker and check that you're running the
latest version of Go:

Run "go version" and compare against
http://golang.org/doc/devel/release.html  If a newer version of Go exists,
install it and retry what you did to reproduce the problem.

Thanks.

What steps will reproduce the problem?
If possible, include a link to a program on play.golang.org.
1. run the code in http://play.golang.org/p/AEAhq3SRSx
2.
3.

What is the expected output?

got local ip address of pptp connection

What do you see instead?

got remote ip address of pptp connection

Which compiler are you using (5g, 6g, 8g, gccgo)?
6g

Which operating system are you using?

Linux y570-yin 3.2.0-37-generic #58-Ubuntu SMP Thu Jan 24 15:28:10 UTC 2013 x86_64
x86_64 x86_64 GNU/Linux


Which version are you using?  (run 'go version')


go version go1.0.3


Please provide any additional information below.

output sample:

want:  IPV4#4, 10.150.250.37/32

got:  IPV4#4, 10.150.250.254/32

---------

Interfaces:
              #0, {1 16436 lo  up|loopback}
              #[127.0.0.1/8 ::1/128], <nil>
              #1, {2 1500 eth0 b8:70:f4:27:0c:1b up|broadcast|multicast}
              #[192.168.102.67/24 fe80::ba70:f4ff:fe27:c1b/64], <nil>
              #2, {3 1500 wlan0 8c:a9:82:b2:eb:ca broadcast|multicast}
              #[], <nil>
              #3, {4 1500 vmnet8 00:50:56:c0:00:08 up|broadcast|multicast}
              #[192.168.99.1/24 fe80::250:56ff:fec0:8/64], <nil>
              #4, {5 1500 vmnet9 00:50:56:c0:00:09 up|broadcast|multicast}
              #[192.168.223.1/24 fe80::250:56ff:fec0:9/64], <nil>
              #5, {8 1400 ppp0  up|pointtopoint|multicast}
              #[10.150.250.254/32], <nil>
InterfaceAddrs:
              IPV4#0, 127.0.0.1/8
              IPV4#1, 192.168.102.67/24
              IPV4#2, 192.168.99.1/24
              IPV4#3, 192.168.223.1/24
              IPV4#4, 10.150.250.254/32
              IPV6#5, ::1/128
              IPV6#6, fe80::ba70:f4ff:fe27:c1b/64
              IPV6#7, fe80::250:56ff:fec0:8/64
              IPV6#8, fe80::250:56ff:fec0:9/64
system command, ip addr list:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
    link/ether b8:70:f4:27:0c:1b brd ff:ff:ff:ff:ff:ff
    inet 192.168.102.67/24 brd 192.168.102.255 scope global eth0
    inet6 fe80::ba70:f4ff:fe27:c1b/64 scope link 
       valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc mq state DOWN qlen 1000
    link/ether 8c:a9:82:b2:eb:ca brd ff:ff:ff:ff:ff:ff
4: vmnet8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state
UNKNOWN qlen 1000
    link/ether 00:50:56:c0:00:08 brd ff:ff:ff:ff:ff:ff
    inet 192.168.99.1/24 brd 192.168.99.255 scope global vmnet8
    inet6 fe80::250:56ff:fec0:8/64 scope link 
       valid_lft forever preferred_lft forever
5: vmnet9: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state
UNKNOWN qlen 1000
    link/ether 00:50:56:c0:00:09 brd ff:ff:ff:ff:ff:ff
    inet 192.168.223.1/24 brd 192.168.223.255 scope global vmnet9
    inet6 fe80::250:56ff:fec0:9/64 scope link 
       valid_lft forever preferred_lft forever
8: ppp0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1400 qdisc pfifo_fast state
UNKNOWN qlen 3
    link/ppp 
    inet 10.150.250.37 peer 10.150.250.254/32 scope global ppp0
@mikioh
Copy link
Contributor

mikioh commented Feb 18, 2013

Comment 1:

Labels changed: added priority-soon, removed priority-triage.

Status changed to Accepted.

@mikioh
Copy link
Contributor

mikioh commented Feb 18, 2013

Comment 3:

On darwin:
ppp0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1444
    inet 192.168.222.234 --> 192.168.111.234 netmask 0xffffff00
interface_test.go:44:   "ppp0": flags "up|pointtopoint|multicast", ifindex 9, mtu 1444
interface_test.go:45:       hardware address ""
interface_test.go:83:       interface address "192.168.222.234/24"
interface_test.go:98:       joined group address "224.0.0.1"
On Linux w/ fix patch:
ppp0      Link encap:Point-to-Point Protocol  
          inet addr:192.168.111.234  P-t-P:192.168.222.234  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1496  Metric:1
interface_test.go:44:   "ppp0": flags "up|pointtopoint|multicast", ifindex 8, mtu 1496
interface_test.go:45:       hardware address ""
interface_test.go:83:       interface address "192.168.111.234/32"
interface_test.go:98:       joined group address "224.0.0.1"
interface_test.go:98:       joined group address "ff02::1"
thanks for the report.

@mikioh
Copy link
Contributor

mikioh commented Feb 18, 2013

Comment 4:

https://golang.org/cl/7352045/

Status changed to Started.

@davecheney
Copy link
Contributor

Comment 5:

@wheelcomplex, can you please test #4 and comment on the CL if it works.

@wheelcomplex
Copy link
Contributor Author

Comment 6:

tested: https://golang.org/cl/7352045/
Work like a charm!
thank you very much.
------------
Interfaces:
              #0, {1 16436 lo  up|loopback}
              #[127.0.0.1/8 ::1/128], <nil>
              #1, {2 1500 eth0 b8:70:f4:27:0c:1b up|broadcast|multicast}
              #[], <nil>
              #2, {3 1500 wlan0 8c:a9:82:b2:eb:ca up|broadcast|multicast}
              #[192.168.5.41/24 fe80::8ea9:82ff:feb2:ebca/64], <nil>
              #3, {4 1500 vmnet8 00:50:56:c0:00:08 up|broadcast|multicast}
              #[192.168.99.1/24 fe80::250:56ff:fec0:8/64], <nil>
              #4, {5 1500 vmnet9 00:50:56:c0:00:09 up|broadcast|multicast}
              #[192.168.223.1/24 fe80::250:56ff:fec0:9/64], <nil>
              #5, {7 1400 ppp0  up|pointtopoint|multicast}
              #[10.150.250.38/32], <nil>
InterfaceAddrs:
              IPV4#0, 127.0.0.1/8
              IPV4#1, 192.168.5.41/24
              IPV4#2, 192.168.99.1/24
              IPV4#3, 192.168.223.1/24
              IPV4#4, 10.150.250.38/32
              IPV6#5, ::1/128
              IPV6#6, fe80::8ea9:82ff:feb2:ebca/64
              IPV6#7, fe80::250:56ff:fec0:8/64
              IPV6#8, fe80::250:56ff:fec0:9/64
system command, ip addr list:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN qlen 1000
    link/ether b8:70:f4:27:0c:1b brd ff:ff:ff:ff:ff:ff
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
    link/ether 8c:a9:82:b2:eb:ca brd ff:ff:ff:ff:ff:ff
    inet 192.168.5.41/24 brd 192.168.5.255 scope global wlan0
    inet6 fe80::8ea9:82ff:feb2:ebca/64 scope link 
       valid_lft forever preferred_lft forever
4: vmnet8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state
UNKNOWN qlen 1000
    link/ether 00:50:56:c0:00:08 brd ff:ff:ff:ff:ff:ff
    inet 192.168.99.1/24 brd 192.168.99.255 scope global vmnet8
    inet6 fe80::250:56ff:fec0:8/64 scope link 
       valid_lft forever preferred_lft forever
5: vmnet9: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state
UNKNOWN qlen 1000
    link/ether 00:50:56:c0:00:09 brd ff:ff:ff:ff:ff:ff
    inet 192.168.223.1/24 brd 192.168.223.255 scope global vmnet9
    inet6 fe80::250:56ff:fec0:9/64 scope link 
       valid_lft forever preferred_lft forever
7: ppp0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1400 qdisc pfifo_fast state
UNKNOWN qlen 3
    link/ppp 
    inet 10.150.250.38 peer 10.150.250.254/32 scope global ppp0

@mikioh
Copy link
Contributor

mikioh commented Feb 19, 2013

Comment 7:

Thank you for the confirmation.

@mikioh
Copy link
Contributor

mikioh commented Feb 19, 2013

Comment 8:

This issue was closed by revision e4890e5.

Status changed to Fixed.

@mikioh
Copy link
Contributor

mikioh commented Feb 28, 2013

Comment 9:

This issue was closed by revision 322214c.

@mikioh
Copy link
Contributor

mikioh commented Feb 14, 2014

Comment 10:

This issue was updated by revision 8c0a52f.

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/57700043

@rsc rsc added this to the Go1.1 milestone Apr 14, 2015
@rsc rsc removed the go1.1maybe label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants