Tun (valgrind and route issue)#1302
Conversation
|
Could you rebase to solve conflicts? Probably caused by Coverity fixes, sorry about it. |
Done. But take care your last coverity fix adds a warning on (and I'm with a -Werror build): |
|
And by the way, I confirm that there's a race condition between the ppp set route and the WARN: Removing wrong route to vpn server... sometime the INFO: Interface pppVPN is UP is triggered without it, leaving the tunnel stuck forever (which is curious because the echo request should trigger the tunnel down. Best regards. |
|
I would rather move 2c5c9a8 to a new PR against the master branch, to discuss this separately. Do any of the commits here, especially the Valgrind findings, apply to the master branch, or only to the tun branch? Again, I would rather move those that apply to the master branch to a separate PR against the master branch. and release a new version before merging the tun branch. |
|
| memcpy(hdlc_buffer, pkt_data(packet) + 2, packet->len - 2); | ||
| } else { | ||
| hdlc_bufsize = estimated_encoded_size(packet->len); | ||
| ssize_t hdlc_bufsize = estimated_encoded_size(packet->len); |
There was a problem hiding this comment.
Make it a size_t instead of a ssize_t, since packet->len is also a size_t?
There was a problem hiding this comment.
well they are negative operations on these values (because hdlc_bufsize and len (not packet->len) are of the same type) , so not sure it is 100% safe in the current code to do so.
At minimum it would require to check the size of the output packet in pppd_read function and drop all packets of a size < 2 if I get it correctly.
And honestly speaking this is present in the whole file, because most of the time these values contains the return value of the read operations like (for example look at pppd_read around lines 1112).
So let me check more deeply if it is "easily" doable or not :) (and I'm not sure this has to be present in this branch anyway, as this code was the previous one and I just moved it "like this" as it was done in previous patch).
Best regards.
There was a problem hiding this comment.
Ok, as I have reduced the scope of the variable, it's easy to do, so I did it. But clearly, the whole code should be reviewed to handle this properly in all parts...
There was a problem hiding this comment.
by the way, take care that the tun branch is far behind the current master (so I rebased this one on the coverity_scan instead of the origin/tun one).
638ca0b to
a19752b
Compare
* Thanks valgrind for pinning this out.
* Thanks valgrind for pinning this out.
* Thanks valgrind for pinning this out.
* NOTE: this might not works if we don't have the remote idea of our ip. * Let's try it with a fake local ip. * credits goes to coverity for this one.
This PR add some various fixes:
Targeted to enhance #1048 .
NOTE: still missing:
still some leaks due to RC are laying around, investigation still in progress.: remaining leaks are due to the way the shutdown is processed. So we can probably ignore them as they are not happening during the running time.