-
Notifications
You must be signed in to change notification settings - Fork 621
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add insert_tcp_options() nasl function #618
Conversation
09698e6
to
cf93025
Compare
This add support for inserting MSS, Wscale, sack permit and timestamp tcp options.
nasl/nasl_packet_forgery.c
Outdated
if (ip->ip_hl * 4 > pktsz) | ||
tcp = | ||
(struct tcphdr *) (pkt | ||
+ 20); /* ip->ip_hl is bogus, we work around that */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The formatting is bad here. Maybe put the comment above the line so the formatter does not do this.
nasl/nasl_packet_forgery.c
Outdated
tcp = (struct tcphdr *) (pkt + ip->ip_hl * 4); | ||
|
||
if (pktsz < UNFIX (ip->ip_len)) | ||
return NULL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
opts need to be freed here I guess.
nasl/nasl_packet_forgery.c
Outdated
source.s_addr = ip->ip_src.s_addr; | ||
dest.s_addr = ip->ip_dst.s_addr; | ||
|
||
bzero (&pseudoheader, sizeof (pseudoheader)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bzero and bcopy are deprecated. memset and memcpy should be used instead.
… of the structures and structure members to be copied.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested with the supplied scripts and tcpdump. Everything works as expected.
Reviewed the fixes to my review and approved them (only them, not the whole code changes here which i can't approve). |
What:
This add support for inserting MSS, Wscale, sack permit and timestamp
tcp options.
Why:
It was not supported and was required.
How:
Run the nasl script below, and check with tcpdump or wireshark that the options are set as expected.
openvas-nasl -X -d -i /<install-prefix>/var/lib/openvas/plugins -t <IPV4 or IPv6 to test the funcs> this_script.nasl
Checklist: