Page MenuHomeFreeBSD

netgraph/ng_tag: Variable length data can not be set for all length
Needs ReviewPublic

Authored by lutz_donnerhacke.de on Oct 24 2019, 11:27 AM.

Details

Reviewers
julian
glebius
mav
Group Reviewers
network
Summary

ng_tag can operate on arbitrary data of mbuf_tags.
This should work for any data sets.

ngctl
+ mkpeer . tag t t
+ msg t sethookin { thisHook="t" tag_len=4 tag_data=[1] }

works. But the following does not:

+ msg t sethookin { thisHook="t" tag_len=1 tag_data=[1] }
ngctl: send msg: Invalid argument

Especially in the case of checking for mbuf_tag values, the length
of checked data is important.

The reason behind this behavior is, that the record size
is padded to the next multiple of the alignment. Therefore
it's sufficient to check for large enough data received.

PR: 241462

Test Plan
+ mkpeer . tag t t
+ msg t sethookin { thisHook="t" tag_len=4 tag_data=[1] }
+ msg t sethookin { thisHook="t" tag_len=1 tag_data=[1] }
+ msg t gethookin "t"
Rec'd response "gethookin" (2) from "[72]:":
Args:   { thisHook="t" tag_len=1 tag_data=[ 0x1 ] }

Diff Detail

Repository
rS FreeBSD src repository
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 27196
Build 25463: arc lint + arc unit

Event Timeline

lutz_donnerhacke.de edited the summary of this revision. (Show Details)Oct 24 2019, 11:34 AM
lutz_donnerhacke.de added inline comments.
sys/netgraph/ng_tag.c
366

Reformatted to more readability and conformance to style(9)

lutz_donnerhacke.de edited the summary of this revision. (Show Details)Oct 24 2019, 2:03 PM
lutz_donnerhacke.de edited the summary of this revision. (Show Details)

I think you need to add people with good knowledge of the netgraph to the reviewers: JulianElischer, Gleb Smirnoff and Alexander Motin. Because apparently not all are subscribed to the network mailing list.