Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
80f79ad3
Commit
80f79ad3
authored
Aug 24, 2011
by
Mikio Hara
Committed by
Russ Cox
Aug 24, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
net: make use of IPv4len, IPv6len
R=golang-dev, rsc CC=golang-dev
https://golang.org/cl/4926046
parent
6ecd5f9f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
5 additions
and
5 deletions
+5
-5
src/pkg/net/dnsclient_unix.go
src/pkg/net/dnsclient_unix.go
+1
-1
src/pkg/net/iprawsock_posix.go
src/pkg/net/iprawsock_posix.go
+2
-2
src/pkg/net/tcpsock_posix.go
src/pkg/net/tcpsock_posix.go
+1
-1
src/pkg/net/udpsock_posix.go
src/pkg/net/udpsock_posix.go
+1
-1
No files found.
src/pkg/net/dnsclient_unix.go
View file @
80f79ad3
...
...
@@ -113,7 +113,7 @@ func convertRR_A(records []dnsRR) []IP {
func
convertRR_AAAA
(
records
[]
dnsRR
)
[]
IP
{
addrs
:=
make
([]
IP
,
len
(
records
))
for
i
,
rr
:=
range
records
{
a
:=
make
(
IP
,
16
)
a
:=
make
(
IP
,
IPv6len
)
copy
(
a
,
rr
.
(
*
dnsRR_AAAA
)
.
AAAA
[
:
])
addrs
[
i
]
=
a
}
...
...
src/pkg/net/iprawsock_posix.go
View file @
80f79ad3
...
...
@@ -25,7 +25,7 @@ func sockaddrToIP(sa syscall.Sockaddr) Addr {
}
func
(
a
*
IPAddr
)
family
()
int
{
if
a
==
nil
||
len
(
a
.
IP
)
<=
4
{
if
a
==
nil
||
len
(
a
.
IP
)
<=
IPv4len
{
return
syscall
.
AF_INET
}
if
a
.
IP
.
To4
()
!=
nil
{
...
...
@@ -158,7 +158,7 @@ func (c *IPConn) ReadFromIP(b []byte) (n int, addr *IPAddr, err os.Error) {
switch
sa
:=
sa
.
(
type
)
{
case
*
syscall
.
SockaddrInet4
:
addr
=
&
IPAddr
{
sa
.
Addr
[
0
:
]}
if
len
(
b
)
>=
4
{
// discard ipv4 header
if
len
(
b
)
>=
IPv4len
{
// discard ipv4 header
hsize
:=
(
int
(
b
[
0
])
&
0xf
)
*
4
copy
(
b
,
b
[
hsize
:
])
n
-=
hsize
...
...
src/pkg/net/tcpsock_posix.go
View file @
80f79ad3
...
...
@@ -23,7 +23,7 @@ func sockaddrToTCP(sa syscall.Sockaddr) Addr {
}
func
(
a
*
TCPAddr
)
family
()
int
{
if
a
==
nil
||
len
(
a
.
IP
)
<=
4
{
if
a
==
nil
||
len
(
a
.
IP
)
<=
IPv4len
{
return
syscall
.
AF_INET
}
if
a
.
IP
.
To4
()
!=
nil
{
...
...
src/pkg/net/udpsock_posix.go
View file @
80f79ad3
...
...
@@ -23,7 +23,7 @@ func sockaddrToUDP(sa syscall.Sockaddr) Addr {
}
func
(
a
*
UDPAddr
)
family
()
int
{
if
a
==
nil
||
len
(
a
.
IP
)
<=
4
{
if
a
==
nil
||
len
(
a
.
IP
)
<=
IPv4len
{
return
syscall
.
AF_INET
}
if
a
.
IP
.
To4
()
!=
nil
{
...
...
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