Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions params_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ type PlatformSpecificParams struct {
// uses multiple file descriptors (queues) to parallelize packets sending
// or receiving.
MultiQueue bool

// If PacketInfo is set the frame format is:
// Flags [2 bytes]
// Proto [2 bytes]
// Raw protocol(IP, IPv6, etc) frame.
PacketInfo bool
}

func defaultPlatformSpecificParams() PlatformSpecificParams {
Expand Down
6 changes: 4 additions & 2 deletions syscalls_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func ioctl(fd uintptr, request uintptr, argp uintptr) error {
}

func setupFd(config Config, fd uintptr) (name string, err error) {
var flags uint16 = cIFFNOPI
var flags uint16
if config.DeviceType == TUN {
flags |= cIFFTUN
} else {
Expand All @@ -38,7 +38,9 @@ func setupFd(config Config, fd uintptr) (name string, err error) {
if config.PlatformSpecificParams.MultiQueue {
flags |= cIFFMULTIQUEUE
}

if !config.PlatformSpecificParams.PacketInfo {
flags |= cIFFNOPI
}
if name, err = createInterface(fd, config.Name, flags); err != nil {
return "", err
}
Expand Down