Merge pull request #3459 from haydenroche5/sniffer_fixes

Fix a couple of issues related to the sniffer.
This commit is contained in:
David Garske
2020-11-04 14:09:43 -08:00
committed by GitHub
2 changed files with 17 additions and 5 deletions

View File

@ -4730,7 +4730,7 @@ static int CheckPreRecord(IpInfo* ipInfo, TcpInfo* tcpInfo,
word32 i, offset, headerSz, qty, remainder;
Trace(CHAIN_INPUT_STR);
headerSz = (word32)*sslFrame - (word32)chain[0].iov_base;
headerSz = (word32)((const byte*)*sslFrame - (const byte*)chain[0].iov_base);
remainder = *sslBytes;
if ( (*sslBytes + length) > ssl->buffers.inputBuffer.bufferSize) {

View File

@ -519,15 +519,27 @@ int main(int argc, char** argv)
#endif
ret = ssl_SetPrivateKey(server, port, argv[2],
FILETYPE_PEM, passwd, err);
if (ret == 0)
loadCount++;
if (loadCount > 0) {
ret = 0;
}
else {
if (loadCount == 0) {
printf("Failed loading private key %d\n", ret);
exit(EXIT_FAILURE);
}
/* Only let through TCP/IP packets */
ret = pcap_compile(pcap, &fp, "(ip6 or ip) and tcp", 0, 0);
if (ret != 0) {
printf("pcap_compile failed %s\n", pcap_geterr(pcap));
exit(EXIT_FAILURE);
}
ret = pcap_setfilter(pcap, &fp);
if (ret != 0) {
printf("pcap_setfilter failed %s\n", pcap_geterr(pcap));
exit(EXIT_FAILURE);
}
}
}
else {