Fix the htons byteorder of vxlan packets after
vxlan_pick_source_port picks a source port during encapsulation.
Details
Check the source port of outgoing packets before and after
applying the patch:
ifconfig vxlan create inet6 2001:db8:a::/48 vni 1 vxlanremote 2001:db8::a vxlanlocal 2001:db8::b vxlanportrange 1234 1234 up
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 67695 Build 64578: arc lint + arc unit
Event Timeline
Looks good to me.
Well, I do not like the inconsistency, that vxlan_encap_header() requires network byte order of srcport and dstport, but vxlan_pick_source_port() generates the host byte order. Given the dstport is from sin[6]_port which is already in network byte order, then it makes no senses to convert it back and forth.
sys/net/if_vxlan.c | ||
---|---|---|
2433 | Hi! Would you at least please consider documenting what the return value here? That way it's clearer to people who are working on this that there are endian expectations? Thanks! |
sys/net/if_vxlan.c | ||
---|---|---|
2433 | Generally we prefer host order, so I think no comments on vxlan_pick_source_port() is good. I'd rather prefer to add comments on vxlan_encap_header(), since it has parameter ipoff which is in host byte order but the parameters srcport and dstport require network byte order. |