"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tools/n2n_decode.c" between
n2n-2.8.tar.gz and n2n-3.0.tar.gz

About: n2n is a layer-two peer-to-peer virtual private network (VPN) which allows bypassing intermediate firewalls.

n2n_decode.c  (n2n-2.8):n2n_decode.c  (n2n-3.0)
/** /**
* (C) 2019 - ntop.org and contributors * (C) 2019-21 - ntop.org and contributors
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
skipping to change at line 47 skipping to change at line 47
static void help() { static void help() {
fprintf(stderr, "n2n-decode -i ifname -k key -c community [-B bpf] [-w fname] [-v]" fprintf(stderr, "n2n-decode -i ifname -k key -c community [-B bpf] [-w fname] [-v]"
#ifdef N2N_HAVE_AES #ifdef N2N_HAVE_AES
" [-A]" " [-A]"
#endif #endif
"\n"); "\n");
fprintf(stderr, "-i <ifname> | Specify the capture interface name .\n"); fprintf(stderr, "-i <ifname> | Specify the capture interface name .\n");
fprintf(stderr, "-c <community> | Specify the community.\n"); fprintf(stderr, "-c <community> | Specify the community.\n");
fprintf(stderr, "-k <key> | Specify the encryption key.\n"); fprintf(stderr, "-k <key> | Specify the encryption key.\n");
#ifdef N2N_HAVE_AES #ifdef N2N_HAVE_AES
fprintf(stderr, "-A | Use AES CBC decryption (default=us e twofish).\n"); fprintf(stderr, "-A | Use AES decryption (default=use tw ofish).\n");
#endif #endif
fprintf(stderr, "-B <bpf> | Use set a BPF filter for the captu re.\n"); fprintf(stderr, "-B <bpf> | Use set a BPF filter for the captu re.\n");
fprintf(stderr, "-w <fname> | Write decoded PCAP to file.\n"); fprintf(stderr, "-w <fname> | Write decoded PCAP to file.\n");
fprintf(stderr, "-v | Increase verbosity level.\n"); fprintf(stderr, "-v | Increase verbosity level.\n");
exit(0); exit(0);
} }
/* *************************************************** */ /* *************************************************** */
skipping to change at line 106 skipping to change at line 106
case N2N_TRANSFORM_ID_NULL: case N2N_TRANSFORM_ID_NULL:
/* Not encrypted, dump it */ /* Not encrypted, dump it */
write_packet(packet, header); write_packet(packet, header);
break; break;
case N2N_TRANSFORM_ID_TWOFISH: case N2N_TRANSFORM_ID_TWOFISH:
if(aes_mode) { if(aes_mode) {
traceEvent(TRACE_INFO, "Skipping twofish encrypted packet"); traceEvent(TRACE_INFO, "Skipping twofish encrypted packet");
return(-1); return(-1);
} }
break; break;
case N2N_TRANSFORM_ID_AESCBC: case N2N_TRANSFORM_ID_AES:
if(!aes_mode) { if(!aes_mode) {
traceEvent(TRACE_INFO, "Skipping AES encrypted packet"); traceEvent(TRACE_INFO, "Skipping AES encrypted packet");
return(-1); return(-1);
} }
break; break;
default: default:
traceEvent(TRACE_INFO, "Skipping unknown transform packet: %d", pkt->transfo rm); traceEvent(TRACE_INFO, "Skipping unknown transform packet: %d", pkt->transfo rm);
return(-2); return(-2);
} }
skipping to change at line 283 skipping to change at line 283
default: default:
help(); help();
} }
} }
if((ifname == NULL) || (conf.encrypt_key == NULL) || (conf.community_name[0] = = '\0')) if((ifname == NULL) || (conf.encrypt_key == NULL) || (conf.community_name[0] = = '\0'))
help(); help();
#ifdef N2N_HAVE_AES #ifdef N2N_HAVE_AES
if(aes_mode) if(aes_mode)
n2n_transop_aes_cbc_init(&conf, &transop); n2n_transop_aes_init(&conf, &transop);
else else
#endif #endif
n2n_transop_twofish_init(&conf, &transop); n2n_transop_tf_init(&conf, &transop);
if((handle = pcap_create(ifname, errbuf)) == NULL) { if((handle = pcap_create(ifname, errbuf)) == NULL) {
traceEvent(TRACE_ERROR, "Cannot open device %s: %s", ifname, errbuf); traceEvent(TRACE_ERROR, "Cannot open device %s: %s", ifname, errbuf);
return(1); return(1);
} }
if((pcap_set_timeout(handle, TIMEOUT) != 0) || if((pcap_set_timeout(handle, TIMEOUT) != 0) ||
(pcap_set_snaplen(handle, SNAPLEN) != 0)) { (pcap_set_snaplen(handle, SNAPLEN) != 0)) {
traceEvent(TRACE_ERROR, "Error while setting timeout/snaplen"); traceEvent(TRACE_ERROR, "Error while setting timeout/snaplen");
return(1); return(1);
 End of changes. 5 change blocks. 
5 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)