Page MenuHomeFreeBSD

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

Authored by donner on Oct 24 2019, 11:27 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Nov 12, 10:43 PM
Unknown Object (File)
Sun, Nov 10, 8:26 AM
Unknown Object (File)
Sat, Nov 9, 8:58 AM
Unknown Object (File)
Sat, Nov 9, 8:34 AM
Unknown Object (File)
Sat, Nov 9, 4:43 AM
Unknown Object (File)
Fri, Nov 8, 10:52 AM
Unknown Object (File)
Wed, Nov 6, 6:44 PM
Unknown Object (File)
Wed, Nov 6, 12:33 PM

Details

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 - subversion
Lint
No Lint Coverage
Unit
No Test Coverage
Build Status
Buildable 33826
Build 31043: arc lint + arc unit

Event Timeline

donner added inline comments.
sys/netgraph/ng_tag.c
366–367

Reformatted to more readability and conformance to style(9)

donner 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.

donner edited the summary of this revision. (Show Details)

Rebase to current

Revert errornous comparsion

kp added a subscriber: kp.

Approved by: kp (mentor)

This revision is now accepted and ready to land.Jan 18 2021, 11:56 AM