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
18 changes: 18 additions & 0 deletions net_xfrm.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,16 @@ type XfrmStat struct {
XfrmOutStateInvalid int
// State hasn’t been fully acquired before use
XfrmAcquireError int
// State direction mismatch
// i.e. lookup found an input state on the output path
XfrmOutStateDirError int
// State direction mismatch
// i.e. lookup found an output state on the input path
XfrmInStateDirError int
// IP-TFS inbound packet processing error
XfrmInIptfsError int
// IP-TFS outbound queue is full
XfrmOutNoQueueSpace int
}

// NewXfrmStat reads the xfrm_stat statistics.
Expand Down Expand Up @@ -181,6 +191,14 @@ func (fs FS) NewXfrmStat() (XfrmStat, error) {
x.XfrmOutStateInvalid = value
case "XfrmAcquireError":
x.XfrmAcquireError = value
case "XfrmOutStateDirError":
x.XfrmOutStateDirError = value
case "XfrmInStateDirError":
x.XfrmInStateDirError = value
case "XfrmInIptfsError":
x.XfrmInIptfsError = value
case "XfrmOutNoQueueSpace":
x.XfrmOutNoQueueSpace = value
}

}
Expand Down
4 changes: 4 additions & 0 deletions net_xfrm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ func TestXfrmStats(t *testing.T) {
{name: "XfrmFwdHdrError", want: 6654, got: xfrmStats.XfrmFwdHdrError},
{name: "XfrmOutStateInvaliad", want: 28765, got: xfrmStats.XfrmOutStateInvalid},
{name: "XfrmAcquireError", want: 24532, got: xfrmStats.XfrmAcquireError},
{name: "XfrmOutStateDirError", want: 11, got: xfrmStats.XfrmOutStateDirError},
{name: "XfrmInStateDirError", want: 12, got: xfrmStats.XfrmInStateDirError},
{name: "XfrmInIptfsError", want: 13, got: xfrmStats.XfrmInIptfsError},
{name: "XfrmOutNoQueueSpace", want: 14, got: xfrmStats.XfrmOutNoQueueSpace},
{name: "XfrmInStateInvalid", want: 55555, got: xfrmStats.XfrmInStateInvalid},
{name: "XfrmOutError", want: 1000000, got: xfrmStats.XfrmOutError},
} {
Expand Down
6 changes: 5 additions & 1 deletion testdata/fixtures.ttar
Original file line number Diff line number Diff line change
Expand Up @@ -2983,7 +2983,7 @@ Inter-| sta-| Quality | Discarded packets | Missed
Mode: 644
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Path: fixtures/proc/net/xfrm_stat
Lines: 28
Lines: 32
XfrmInError 1
XfrmInBufferError 2
XfrmInHdrError 4
Expand Down Expand Up @@ -3012,6 +3012,10 @@ XfrmOutPolError 1454
XfrmFwdHdrError 6654
XfrmOutStateInvalid 28765
XfrmAcquireError 24532
XfrmOutStateDirError 11
XfrmInStateDirError 12
XfrmInIptfsError 13
XfrmOutNoQueueSpace 14
Mode: 644
# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Directory: fixtures/proc/pressure
Expand Down