OLD | NEW |
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 // Routing sockets and messages for Darwin | 5 // Routing sockets and messages for Darwin |
6 | 6 |
7 package syscall | 7 package syscall |
8 | 8 |
9 import ( | 9 import ( |
10 "unsafe" | 10 "unsafe" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 buf := m.Data[:] | 57 buf := m.Data[:] |
58 for i := uint(0); i < RTAX_MAX; i++ { | 58 for i := uint(0); i < RTAX_MAX; i++ { |
59 if m.Header.Addrs&rtaIfmaMask&(1<<i) == 0 { | 59 if m.Header.Addrs&rtaIfmaMask&(1<<i) == 0 { |
60 continue | 60 continue |
61 } | 61 } |
62 rsa := (*RawSockaddr)(unsafe.Pointer(&buf[0])) | 62 rsa := (*RawSockaddr)(unsafe.Pointer(&buf[0])) |
63 switch i { | 63 switch i { |
64 case RTAX_IFA: | 64 case RTAX_IFA: |
65 sa, e := anyToSockaddr((*RawSockaddrAny)(unsafe.Pointer(
rsa))) | 65 sa, e := anyToSockaddr((*RawSockaddrAny)(unsafe.Pointer(
rsa))) |
66 » » » if e != 0 { | 66 » » » if e != nil { |
67 return nil | 67 return nil |
68 } | 68 } |
69 sas = append(sas, sa) | 69 sas = append(sas, sa) |
70 case RTAX_GATEWAY, RTAX_IFP: | 70 case RTAX_GATEWAY, RTAX_IFP: |
71 // nothing to do | 71 // nothing to do |
72 } | 72 } |
73 buf = buf[rsaAlignOf(int(rsa.Len)):] | 73 buf = buf[rsaAlignOf(int(rsa.Len)):] |
74 } | 74 } |
75 | 75 |
76 return sas | 76 return sas |
77 } | 77 } |
OLD | NEW |