Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
33a15eb6
Commit
33a15eb6
authored
Sep 23, 2011
by
Mikio Hara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
net: make use of AF_UNSPEC instead of individual address family
R=fullung, rsc CC=golang-dev
https://golang.org/cl/5034044
parent
46ed89b7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
24 deletions
+10
-24
interface_bsd.go
src/pkg/net/interface_bsd.go
+0
-1
interface_linux.go
src/pkg/net/interface_linux.go
+10
-23
No files found.
src/pkg/net/interface_bsd.go
View file @
33a15eb6
...
...
@@ -150,7 +150,6 @@ func newAddr(m *syscall.InterfaceAddrMessage) ([]Addr, os.Error) {
}
for
_
,
s
:=
range
sas
{
switch
v
:=
s
.
(
type
)
{
case
*
syscall
.
SockaddrInet4
:
ifa
:=
&
IPAddr
{
IP
:
IPv4
(
v
.
Addr
[
0
],
v
.
Addr
[
1
],
v
.
Addr
[
2
],
v
.
Addr
[
3
])}
...
...
src/pkg/net/interface_linux.go
View file @
33a15eb6
...
...
@@ -103,42 +103,29 @@ func linkFlags(rawFlags uint32) Flags {
// for a specific interface.
func
interfaceAddrTable
(
ifindex
int
)
([]
Addr
,
os
.
Error
)
{
var
(
tab
[]
byte
e
int
err
os
.
Error
ifat4
[]
Addr
ifat6
[]
Addr
msgs4
[]
syscall
.
NetlinkMessage
msgs6
[]
syscall
.
NetlinkMessage
tab
[]
byte
e
int
err
os
.
Error
ifat
[]
Addr
msgs
[]
syscall
.
NetlinkMessage
)
tab
,
e
=
syscall
.
NetlinkRIB
(
syscall
.
RTM_GETADDR
,
syscall
.
AF_
INET
)
tab
,
e
=
syscall
.
NetlinkRIB
(
syscall
.
RTM_GETADDR
,
syscall
.
AF_
UNSPEC
)
if
e
!=
0
{
return
nil
,
os
.
NewSyscallError
(
"netlink rib"
,
e
)
}
msgs4
,
e
=
syscall
.
ParseNetlinkMessage
(
tab
)
if
e
!=
0
{
return
nil
,
os
.
NewSyscallError
(
"netlink message"
,
e
)
}
ifat4
,
err
=
addrTable
(
msgs4
,
ifindex
)
if
err
!=
nil
{
return
nil
,
err
}
tab
,
e
=
syscall
.
NetlinkRIB
(
syscall
.
RTM_GETADDR
,
syscall
.
AF_INET6
)
if
e
!=
0
{
return
nil
,
os
.
NewSyscallError
(
"netlink rib"
,
e
)
}
msgs6
,
e
=
syscall
.
ParseNetlinkMessage
(
tab
)
msgs
,
e
=
syscall
.
ParseNetlinkMessage
(
tab
)
if
e
!=
0
{
return
nil
,
os
.
NewSyscallError
(
"netlink message"
,
e
)
}
ifat6
,
err
=
addrTable
(
msgs6
,
ifindex
)
ifat
,
err
=
addrTable
(
msgs
,
ifindex
)
if
err
!=
nil
{
return
nil
,
err
}
return
append
(
ifat4
,
ifat6
...
)
,
nil
return
ifat
,
nil
}
func
addrTable
(
msgs
[]
syscall
.
NetlinkMessage
,
ifindex
int
)
([]
Addr
,
os
.
Error
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment