Page MenuHomeFreeBSD

udp_input: remove a BSD stack relict
ClosedPublic

Authored by glebius on Oct 28 2021, 10:39 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Apr 21, 9:24 AM
Unknown Object (File)
Sun, Apr 20, 9:39 AM
Unknown Object (File)
Sat, Apr 19, 3:18 AM
Unknown Object (File)
Fri, Apr 18, 5:03 AM
Unknown Object (File)
Mar 20 2025, 12:47 AM
Unknown Object (File)
Mar 11 2025, 6:34 PM
Unknown Object (File)
Mar 2 2025, 8:29 AM
Unknown Object (File)
Feb 23 2025, 10:06 PM

Details

Summary

I should had removed it 9 years ago in 8ad458a471ca. That commit
left save_ip as a write-only variable.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 42528
Build 39416: arc lint + arc unit

Event Timeline

It isn't write only variable. At line 501 original IP header can be changed, this variable keeps its copy.

Thanks Andrew for noticing that checksum calculation actually
alters IP header, despite the char b[9] saver.

ae added inline comments.
sys/netinet/udp_usrreq.c
492

What you think, if do it like this:

char b[offsetof(struct ipovly, ih_src)];
struct ipovly *p = (stuct ipovly *)ip;

bcopy(p, b, sizeof(b));
bzero(p, sizeof(p->ih_x1));
p->ih_len = ...
...
bcopy(b, p, sizeof(b));
This revision is now accepted and ready to land.Nov 2 2021, 7:17 PM
In D32719#738820, @ae wrote:

It isn't write only variable. At line 501 original IP header can be changed, this variable keeps its copy.

There is another saver there - the char b[9]. It saves everything and restores back. The only value thrashed

sys/netinet/udp_usrreq.c
492

Great idea, thanks!

Implement as Andrey suggests.

This revision now requires review to proceed.Nov 2 2021, 7:52 PM
This revision was not accepted when it landed; it landed in state Needs Review.Nov 3 2021, 5:45 PM
This revision was automatically updated to reflect the committed changes.
zlei added inline comments.
sys/netinet/udp_usrreq.c
492

offsetof(struct ipovly, ih_src) is actually 12, not the same with the original hardcode 9. Is this intentional ?