Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(73)

Side by Side Diff: src/pkg/syscall/route_bsd.go

Issue 12332043: code review 12332043: syscall: fix IPv6 wrong network mask on latest FreeBSD (Closed)
Patch Set: diff -r 1169c3ec0059 https://code.google.com/p/go Created 11 years, 7 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/pkg/net/interface_test.go ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Go Authors. All rights reserved. 1 // Copyright 2011 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // +build darwin freebsd netbsd openbsd 5 // +build darwin freebsd netbsd openbsd
6 6
7 // Routing sockets and messages 7 // Routing sockets and messages
8 8
9 package syscall 9 package syscall
10 10
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 rsa := (*RawSockaddr)(unsafe.Pointer(&b[0])) 149 rsa := (*RawSockaddr)(unsafe.Pointer(&b[0]))
150 switch i { 150 switch i {
151 case RTAX_IFA: 151 case RTAX_IFA:
152 sa, err := anyToSockaddr((*RawSockaddrAny)(unsafe.Pointe r(rsa))) 152 sa, err := anyToSockaddr((*RawSockaddrAny)(unsafe.Pointe r(rsa)))
153 if err != nil { 153 if err != nil {
154 return nil 154 return nil
155 } 155 }
156 sas = append(sas, sa) 156 sas = append(sas, sa)
157 case RTAX_NETMASK: 157 case RTAX_NETMASK:
158 if rsa.Family == AF_UNSPEC { 158 if rsa.Family == AF_UNSPEC {
159 » » » » rsa.Family = AF_INET // an old fasion, AF_UNSPEC means AF_INET 159 » » » » switch rsa.Len {
160 » » » » case SizeofSockaddrInet4:
161 » » » » » rsa.Family = AF_INET
162 » » » » case SizeofSockaddrInet6:
163 » » » » » rsa.Family = AF_INET6
164 » » » » default:
165 » » » » » rsa.Family = AF_INET // an old fasion, A F_UNSPEC means AF_INET
166 » » » » }
160 } 167 }
161 sa, err := anyToSockaddr((*RawSockaddrAny)(unsafe.Pointe r(rsa))) 168 sa, err := anyToSockaddr((*RawSockaddrAny)(unsafe.Pointe r(rsa)))
162 if err != nil { 169 if err != nil {
163 return nil 170 return nil
164 } 171 }
165 sas = append(sas, sa) 172 sas = append(sas, sa)
166 case RTAX_BRD: 173 case RTAX_BRD:
167 // nothing to do 174 // nothing to do
168 } 175 }
169 b = b[rsaAlignOf(int(rsa.Len)):] 176 b = b[rsaAlignOf(int(rsa.Len)):]
(...skipping 13 matching lines...) Expand all
183 b = b[any.Msglen:] 190 b = b[any.Msglen:]
184 } 191 }
185 return msgs, nil 192 return msgs, nil
186 } 193 }
187 194
188 // ParseRoutingMessage parses msg's payload as raw sockaddrs and 195 // ParseRoutingMessage parses msg's payload as raw sockaddrs and
189 // returns the slice containing the Sockaddr interfaces. 196 // returns the slice containing the Sockaddr interfaces.
190 func ParseRoutingSockaddr(msg RoutingMessage) (sas []Sockaddr, err error) { 197 func ParseRoutingSockaddr(msg RoutingMessage) (sas []Sockaddr, err error) {
191 return append(sas, msg.sockaddr()...), nil 198 return append(sas, msg.sockaddr()...), nil
192 } 199 }
OLDNEW
« no previous file with comments | « src/pkg/net/interface_test.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b