Skip to content

Commit

Permalink
set IPs before bringing interface up
Browse files Browse the repository at this point in the history
  • Loading branch information
JackDoanRivian committed Sep 20, 2024
1 parent 09d334f commit adaa3bf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions overlay/tun_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,16 +357,16 @@ func (t *tun) Activate() error {
t.l.WithError(err).Error("Failed to set tun tx queue length")
}

if err = t.addIPs(link); err != nil {
return err
}

// Bring up the interface
ifrf.Flags = ifrf.Flags | unix.IFF_UP
if err = ioctl(t.ioctlFd, unix.SIOCSIFFLAGS, uintptr(unsafe.Pointer(&ifrf))); err != nil {
return fmt.Errorf("failed to bring the tun device up: %s", err)
}

if err = t.addIPs(link); err != nil {
return err
}

// Run the interface
ifrf.Flags = ifrf.Flags | unix.IFF_UP | unix.IFF_RUNNING
if err = ioctl(t.ioctlFd, unix.SIOCSIFFLAGS, uintptr(unsafe.Pointer(&ifrf))); err != nil {
Expand Down

0 comments on commit adaa3bf

Please sign in to comment.