Skip to content

Commit

Permalink
tunnel: wireup ownership info to reverser
Browse files Browse the repository at this point in the history
  • Loading branch information
ignoramous committed Jan 28, 2025
1 parent 71e7795 commit f359d21
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tunnel/tunnel.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"fmt"
"os"
"path/filepath"
"strconv"
"sync"
"sync/atomic"
"syscall"
Expand Down Expand Up @@ -189,13 +190,15 @@ func NewGTunnel(pctx context.Context, fd, mtu int, l3 string, hdl netstack.GConn
}
netstack.Route(stack, l3)

who := strconv.Itoa(ep.Cur())

var nic tcpip.NICID
// Enabled() may temporarily return false when Up() is in progress.
if nic, err = netstack.Up(stack, ep, hdl); err != nil { // attach new endpoint
if nic, err = netstack.Up(who, stack, ep, hdl); err != nil { // attach new endpoint
return nil, nil, err
}

rev = netstack.NewReverseGConnHandler(pctx, stack, nic, ep, hdl)
rev = netstack.NewReverseGConnHandler(who, pctx, stack, nic, ep, hdl)

log.I("tun: new netstack(%d) up; fd(%d=>%d), mtu(%d)", nic, fd, dupfd, mtu)

Expand Down

0 comments on commit f359d21

Please sign in to comment.