Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tunnel: wireup ownership info to netstack
Browse files Browse the repository at this point in the history
ignoramous committed Jan 28, 2025

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
1 parent 71e7795 commit 1b31c86
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
@@ -29,6 +29,7 @@ import (
"fmt"
"os"
"path/filepath"
"strconv"
"sync"
"sync/atomic"
"syscall"
@@ -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)

0 comments on commit 1b31c86

Please sign in to comment.