@@ -11,7 +11,7 @@ import (
1111 "github.com/shadowy-pycoder/mshark/native"
1212)
1313
14- // https://.com/
14+ // https://pcapng .com/
1515const (
1616 shbBlockType uint32 = 0x0a0d0d0a
1717 byteOrderMagic uint32 = 0x1a2b3c4d
@@ -66,7 +66,7 @@ func (pw *Writer) WriteHeader(app string, in *net.Interface, expr string, snaple
6666
6767// writeSHB writes a Section Header Block (SHB) to the file.
6868//
69- // https://www.ietf.org/archive/id/draft-tuexen-opsawg--05.html#section_shb
69+ // https://www.ietf.org/archive/id/draft-tuexen-opsawg-pcapng -05.html#section_shb
7070func (pw * Writer ) writeSHB (app string ) error {
7171 options , err := pw .writeShbOptions (app )
7272 if err != nil {
@@ -148,7 +148,7 @@ func (pw *Writer) writeShbOptions(app string) ([]byte, error) {
148148
149149// writeIDB writes an Interface Description Block (IDB) to the file.
150150//
151- // https://www.ietf.org/archive/id/draft-tuexen-opsawg--05.html#name-interface-description-block
151+ // https://www.ietf.org/archive/id/draft-tuexen-opsawg-pcapng -05.html#name-interface-description-block
152152func (pw * Writer ) writeIDB (in * net.Interface , expr string , snaplen int ) error {
153153 options , err := pw .writeIdbOptions (in , expr )
154154 if err != nil {
@@ -217,7 +217,7 @@ func (pw *Writer) writeIdbOptions(in *net.Interface, expr string) ([]byte, error
217217 buf .Write (bytes .Repeat (zero , ifNamePad ))
218218 binary .Write (buf , nativeEndian , ifMACCode )
219219 binary .Write (buf , nativeEndian , uint16 (6 ))
220- if in .Name == "any" {
220+ if in .Name == "any" || in . Index == 0 {
221221 buf .Write (bytes .Repeat (zero , 6 ))
222222 } else {
223223 binary .Write (buf , nativeEndian , in .HardwareAddr )
@@ -242,7 +242,7 @@ func (pw *Writer) writeIdbOptions(in *net.Interface, expr string) ([]byte, error
242242
243243// WritePacket writes an Enhanced Packet Block (EPB) to the file.
244244//
245- // https://www.ietf.org/archive/id/draft-tuexen-opsawg--05.html#name-enhanced-packet-block
245+ // https://www.ietf.org/archive/id/draft-tuexen-opsawg-pcapng -05.html#name-enhanced-packet-block
246246func (pw * Writer ) WritePacket (timestamp time.Time , data []byte ) error {
247247 packetLen := len (data )
248248 blockLen := 4 + 4 + 4 + 4 + 4 + 4 + 4 + packetLen + 4
0 commit comments