Skip to content

Commit

Permalink
Merge pull request #4 from tianon/slight-netlink-cleanup
Browse files Browse the repository at this point in the history
Update NetworkChangeName to be more similar to my original
  • Loading branch information
crosbymichael committed Feb 10, 2014
2 parents 5244165 + 3a7c144 commit ccf2b96
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/netlink/netlink_linux.go
Expand Up @@ -662,15 +662,17 @@ func getIfSocket() (int, error) {
return -1, sErr
}

// from <net/if.h>
const IFNAMSIZ = 16

func NetworkChangeName(oldName, newName string) error {
fd, err := getIfSocket()
if err != nil {
return err
}
defer syscall.Close(fd)
IFNAMSIZ := 16

data := [32]byte{}
data := [IFNAMSIZ * 2]byte{}
copy(data[:IFNAMSIZ-1], oldName)
copy(data[IFNAMSIZ:IFNAMSIZ*2-1], newName)

Expand Down

0 comments on commit ccf2b96

Please sign in to comment.