The function pr_pack() prints out a packet, if the IP packet contains options, these are printed as well.
Test the functionality fixed in 70960bb86a3ba5b6f5c4652e613e6313a7ed1ac1.
Differential D38470
ping tests: Add tests for IP header options jlduran on Feb 9 2023, 8:46 PM. Authored by Tags None Referenced Files
Subscribers
Details
The function pr_pack() prints out a packet, if the IP packet contains options, these are printed as well. Test the functionality fixed in 70960bb86a3ba5b6f5c4652e613e6313a7ed1ac1. DISCLAIMER: My preferred route would be to implement D38431, however for reasons detailed in that review, we'll resort to fixing what we currently have.
Diff Detail
Event Timeline
Comment Actions Address comments:
Comment Actions So isn't there now a mismatch between hlen and cp when handling IPOPT_LSRR and other options? The loop header increments cp once each iteration but doesn't decrement hlen to match. Perhaps this suggests that the better solution is to handle IPOPT_EOL by forcibly breaking out of the loop, rather than setting hlen to zero? Comment Actions I'll test locally with a packet containing LSRR options with just a couple of routers + NOP and see the remaining hlen value.
I believe it is doing both. If it helps, I have somewhere another branch where I declare an int optslen var, which is hlen - sizeof(struct ip), and use it inside the for loop insted of hlen, kind of like it was before. Why the original authors decrease hlen, I haven't investigated, but there's probably a historical reason. With this patch hlen ends being either 0 or 20 depending on whether the original IP packet had options or not. |