@@ -61,10 +61,10 @@ type Tunnel interface {
61
61
SetLink (fd int ) error
62
62
// Sets the MTU.
63
63
SetMTU (mtu int32 )
64
- // Unsets existing link and closes the fd (tun device).
65
- Unlink () error
66
64
// New route
67
65
SetRoute (engine int ) error
66
+ // Unsets existing link and closes the fd (tun device).
67
+ Unlink () error
68
68
// Set or unset the pcap sink
69
69
SetPcap (fpcap string ) error
70
70
// NIC, IP, TCP, UDP, and ICMP stats.
@@ -167,7 +167,7 @@ func (t *gtunnel) Write([]byte) (int, error) {
167
167
}
168
168
169
169
// fd must be non-blocking.
170
- func NewGTunnel (pctx context.Context , fd , mtu int , hdl netstack.GConnHandler ) (t * gtunnel , rev netstack.GConnHandler , err error ) {
170
+ func NewGTunnel (pctx context.Context , fd , mtu int , l3 string , hdl netstack.GConnHandler ) (t * gtunnel , rev netstack.GConnHandler , err error ) {
171
171
dupfd , err := dup (fd ) // tunnel will own dupfd
172
172
if err != nil {
173
173
return nil , nil , err
@@ -180,7 +180,11 @@ func NewGTunnel(pctx context.Context, fd, mtu int, hdl netstack.GConnHandler) (t
180
180
if eerr != nil {
181
181
return nil , nil , eerr
182
182
}
183
- netstack .Route (stack , settings .IP46 ) // always dual-stack
183
+
184
+ if l3 != settings .IP46 {
185
+ log .W ("tun: new netstack(%d) l3 is %s needed %s" , fd , l3 , settings .IP46 )
186
+ }
187
+ netstack .Route (stack , l3 )
184
188
185
189
var nic tcpip.NICID
186
190
// Enabled() may temporarily return false when Up() is in progress.
0 commit comments