ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/gvpe/src/conf.C
(Generate patch)

Comparing gvpe/src/conf.C (file contents):
Revision 1.63 by root, Thu Jul 18 13:35:16 2013 UTC vs.
Revision 1.67 by root, Thu Oct 25 04:32:27 2018 UTC

1/* 1/*
2 conf.C -- configuration code 2 conf.C -- configuration code
3 Copyright (C) 2003-2008,2011 Marc Lehmann <gvpe@schmorp.de> 3 Copyright (C) 2003-2008,2011,2018 Marc Lehmann <gvpe@schmorp.de>
4 4
5 This file is part of GVPE. 5 This file is part of GVPE.
6 6
7 GVPE is free software; you can redistribute it and/or modify it 7 GVPE is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the 8 under the terms of the GNU General Public License as published by the
236configuration_parser::parse_line (char *line) 236configuration_parser::parse_line (char *line)
237{ 237{
238 { 238 {
239 char *end = line + strlen (line); 239 char *end = line + strlen (line);
240 240
241 while (*end < ' ' && end >= line) 241 while (end >= line && *end < ' ')
242 end--; 242 end--;
243 243
244 *++end = 0; 244 *++end = 0;
245 } 245 }
246 246
286 loglevel l = string_to_loglevel (val); 286 loglevel l = string_to_loglevel (val);
287 287
288 if (l == L_NONE) 288 if (l == L_NONE)
289 return _("unknown loglevel, ignored"); 289 return _("unknown loglevel, ignored");
290 } 290 }
291 else if (!strcmp (var, "serial"))
292 strncpy (conf.serial, val, sizeof (conf.serial));
291 else if (!strcmp (var, "ip-proto")) 293 else if (!strcmp (var, "ip-proto"))
292 conf.ip_proto = atoi (val); 294 conf.ip_proto = atoi (val);
293 else if (!strcmp (var, "icmp-type")) 295 else if (!strcmp (var, "icmp-type"))
294 { 296 {
295#if ENABLE_ICMP 297#if ENABLE_ICMP
462 } 464 }
463 else if (!strcmp (var, "inherit-tos")) 465 else if (!strcmp (var, "inherit-tos"))
464 parse_bool (node->inherit_tos, "inherit-tos", true, false); 466 parse_bool (node->inherit_tos, "inherit-tos", true, false);
465 else if (!strcmp (var, "compress")) 467 else if (!strcmp (var, "compress"))
466 parse_bool (node->compress, "compress", true, false); 468 parse_bool (node->compress, "compress", true, false);
469 else if (!strcmp (var, "low-power"))
470 parse_bool (node->low_power, "low-power", true, false);
467 // all these bool options really really cost a lot of executable size! 471 // all these bool options really really cost a lot of executable size!
468 else if (!strcmp (var, "enable-tcp")) 472 else if (!strcmp (var, "enable-tcp"))
469 { 473 {
470#if ENABLE_TCP 474#if ENABLE_TCP
471 u8 v; parse_bool (v, "enable-tcp" , PROT_TCPv4, 0); node->protocols = (node->protocols & ~PROT_TCPv4) | v; 475 u8 v; parse_bool (v, "enable-tcp" , PROT_TCPv4, 0); node->protocols = (node->protocols & ~PROT_TCPv4) | v;
644 slog (L_NOTICE, _("local node ('%s') not found in config file, aborting."), ::thisnode); 648 slog (L_NOTICE, _("local node ('%s') not found in config file, aborting."), ::thisnode);
645 exit (EXIT_FAILURE); 649 exit (EXIT_FAILURE);
646 } 650 }
647 651
648 if (conf.rsa_key && conf.thisnode->rsa_key) 652 if (conf.rsa_key && conf.thisnode->rsa_key)
649 if (BN_cmp (conf.rsa_key->n, conf.thisnode->rsa_key->n) != 0 653 {
650 || BN_cmp (conf.rsa_key->e, conf.thisnode->rsa_key->e) != 0) 654 const BIGNUM *conf_n, *conf_e, *thisnode_n, *thisnode_e;
655
656#if OPENSSL_VERSION_NUMBER >= 0x10100000 && !LIBRESSL_VERSION_NUMBER
657 RSA_get0_key (conf.rsa_key, &conf_n, &conf_e, 0);
658 RSA_get0_key (conf.thisnode->rsa_key, &thisnode_n, &thisnode_e, 0);
659#else
660 conf_n = conf.thisnode->rsa_key->n;
661 conf_e = conf.thisnode->rsa_key->e;
662 thisnode_n = conf.rsa_key->n;
663 thisnode_e = conf.rsa_key->e;
664#endif
665 if (BN_cmp (conf_n, thisnode_n) != 0 || BN_cmp (conf_e, thisnode_e) != 0)
651 { 666 {
652 slog (L_NOTICE, _("private hostkey and public node key mismatch: is '%s' the correct node?"), ::thisnode); 667 slog (L_NOTICE, _("private hostkey and public node key mismatch: is '%s' the correct node?"), ::thisnode);
653 exit (EXIT_FAILURE); 668 exit (EXIT_FAILURE);
654 } 669 }
670 }
655 } 671 }
656 } 672 }
657 673
658 parse_argv (); 674 parse_argv ();
659} 675}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines