Skip to content

Commit 5ffc8e3

Browse files
committed
netstack: m logs
1 parent 75755d1 commit 5ffc8e3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

intra/netstack/fdbased.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ func (e *endpoint) WritePackets(pkts stack.PacketBufferList) (int, tcpip.Error)
388388
const batchSz = 47
389389
fd := e.fd() // may have been closed
390390
if fd == invalidfd { // unlikely; panic instead?
391-
log.E("ns: WritePackets (to tun): fd invalid")
391+
log.E("ns: tun(-1): WritePackets (to tun): fd invalid")
392392
return 0, &tcpip.ErrNoSuchFile{}
393393
}
394394
batch := make([]unix.Iovec, 0, batchSz)
@@ -434,14 +434,15 @@ func (e *endpoint) dispatchLoop(inbound linkDispatcher) tcpip.Error {
434434
e.wg.Add(1)
435435
defer e.wg.Done()
436436

437+
fd := e.fd()
437438
if inbound == nil {
438-
log.W("ns: dispatchLoop: inbound nil")
439+
log.W("ns: tun(%d): dispatchLoop: inbound nil", fd)
439440
return &tcpip.ErrUnknownDevice{}
440441
}
441442
for {
442443
cont, err := inbound.dispatch()
443444
if err != nil || !cont {
444-
log.I("ns: dispatchLoop: exit; err(%v)", err)
445+
log.I("ns: tun(%d): dispatchLoop: exit; err(%v)", fd, err)
445446
return err
446447
}
447448
}

0 commit comments

Comments
 (0)