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)
Fri, Mar 29, 9:21 PM
Unknown Object (File)
Fri, Mar 29, 9:21 PM
Unknown Object (File)
Feb 10 2024, 7:04 AM
Unknown Object (File)
Jan 25 2024, 1:05 PM
Unknown Object (File)
Dec 21 2023, 7:51 PM
Unknown Object (File)
Dec 20 2023, 5:28 AM
Unknown Object (File)
Oct 13 2023, 12:19 PM
Unknown Object (File)
Oct 11 2023, 4:39 PM
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
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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.