I should had removed it 9 years ago in 8ad458a471ca. That commit
left save_ip as a write-only variable.
Details
Details
- Reviewers
ae - Group Reviewers
transport network - Commits
- rG3358df297325: udp_input: remove a BSD stack relict
Diff Detail
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 42425 Build 39313: arc lint + arc unit
Event Timeline
Comment Actions
It isn't write only variable. At line 501 original IP header can be changed, this variable keeps its copy.
Comment Actions
Thanks Andrew for noticing that checksum calculation actually
alters IP header, despite the char b[9] saver.
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)); |
Comment Actions
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! |
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 ? |