Skip to content

Commit 1776e56

Browse files
committed
prog: Allow explicit ifindex specification
Signed-off-by: Aapo Poutanen <[email protected]>
1 parent 41958b7 commit 1776e56

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

prog.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ type ProgramSpec struct {
110110
// Type determines at which hook in the kernel a program will run.
111111
Type ProgramType
112112

113+
// Network interface index the user intends to attach this program to after loading. Only valid for some program types.
114+
Ifindex uint32
115+
113116
// AttachType of the program, needed to differentiate allowed context
114117
// accesses in some newer program types like CGroupSockAddr.
115118
//
@@ -280,6 +283,7 @@ func newProgramWithOptions(spec *ProgramSpec, opts ProgramOptions, c *btf.Cache)
280283
ProgName: maybeFillObjName(spec.Name),
281284
ProgType: sys.ProgType(progType),
282285
ProgFlags: spec.Flags,
286+
ProgIfindex: spec.Ifindex,
283287
ExpectedAttachType: sys.AttachType(spec.AttachType),
284288
License: sys.NewStringPointer(spec.License),
285289
KernVersion: kv,

0 commit comments

Comments
 (0)