Page MenuHomeFreeBSD

udp_input: remove a BSD stack relict
ClosedPublic

Authored by glebius on Oct 28 2021, 10:39 PM.
Tags
None
Referenced Files
F95904130: D32719.id97955.diff
Sun, Sep 22, 11:49 PM
Unknown Object (File)
Sun, Sep 8, 10:23 PM
Unknown Object (File)
Thu, Sep 5, 8:37 AM
Unknown Object (File)
Mon, Sep 2, 12:10 PM
Unknown Object (File)
Sat, Aug 31, 9:49 PM
Unknown Object (File)
Aug 19 2024, 12:11 AM
Unknown Object (File)
Aug 18 2024, 11:45 PM
Unknown Object (File)
Aug 18 2024, 7:03 AM
Subscribers

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 42530
Build 39418: 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–493

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–493

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.