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

Delta Between Two Patch Sets: ipv4/sys_mreq.go

Issue 97800043: code review 97800043: go.net/ipv4: add support for dragonfly (Closed)
Left Patch Set: diff -r 424a15ce8b2f https://code.google.com/p/go.net Created 9 years, 11 months ago
Right Patch Set: diff -r 9c33002573cb https://code.google.com/p/go.net Created 9 years, 10 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:
Right: Side by side diff | Download
« no previous file with change/comment | « ipv4/sys_linux.go ('k') | ipv4/sys_windows.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 // Copyright 2014 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 // +build darwin dragonfly netbsd openbsd windows
6
7 package ipv4
8
9 import (
10 "net"
11 "syscall"
12 )
13
14 func setSysIPMreqInterface(mreq *syscall.IPMreq, ifi *net.Interface) error {
15 if ifi == nil {
16 return nil
17 }
18 ifat, err := ifi.Addrs()
19 if err != nil {
20 return err
21 }
22 for _, ifa := range ifat {
23 switch v := ifa.(type) {
24 case *net.IPAddr:
25 if ip := v.IP.To4(); ip != nil {
26 copy(mreq.Interface[:], ip)
27 return nil
28 }
29 case *net.IPNet:
30 if ip := v.IP.To4(); ip != nil {
31 copy(mreq.Interface[:], ip)
32 return nil
33 }
34 }
35 }
36 return errNoSuchInterface
37 }
LEFTRIGHT

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