X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fnet_setup.c;h=b31bed737e0653ae0a0c8fb1a7bf130a6c6364a0;hb=ce8775000ab38229a78ecf3dc26bab008ca0f332;hp=9c188957afa449c5fca8849f69d0884893cae642;hpb=a22041922f160667573e9a5ae3f4195e1668906a;p=tinc diff --git a/src/net_setup.c b/src/net_setup.c index 9c188957..b31bed73 100644 --- a/src/net_setup.c +++ b/src/net_setup.c @@ -3,6 +3,7 @@ Copyright (C) 1998-2005 Ivo Timmermans, 2000-2010 Guus Sliepen 2006 Scott Lamb + 2010 Brandon Black 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 @@ -229,6 +230,7 @@ bool setup_myself(void) { struct addrinfo *ai, *aip, hint = {0}; bool choice; int i, err; + int replaywin_int; myself = new_node(); myself->connection = new_connection(); @@ -358,6 +360,28 @@ bool setup_myself(void) { } else maxtimeout = 900; + if(get_config_int(lookup_config(config_tree, "UDPRcvBuf"), &udp_rcvbuf)) { + if(udp_rcvbuf <= 0) { + logger(LOG_ERR, "UDPRcvBuf cannot be negative!"); + return false; + } + } + + if(get_config_int(lookup_config(config_tree, "UDPSndBuf"), &udp_sndbuf)) { + if(udp_sndbuf <= 0) { + logger(LOG_ERR, "UDPSndBuf cannot be negative!"); + return false; + } + } + + if(get_config_int(lookup_config(config_tree, "ReplayWindow"), &replaywin_int)) { + if(replaywin_int < 0) { + logger(LOG_ERR, "ReplayWindow cannot be negative!"); + return false; + } + replaywin = (unsigned)replaywin_int; + } + if(get_config_string(lookup_config(config_tree, "AddressFamily"), &afname)) { if(!strcasecmp(afname, "IPv4")) addressfamily = AF_INET; @@ -391,7 +415,7 @@ bool setup_myself(void) { /* Check if we want to use message authentication codes... */ - if(!get_config_string(lookup_config(myself->connection->config_tree, "Digest"), &digest)) + if(!get_config_string(lookup_config(config_tree, "Digest"), &digest)) digest = xstrdup("sha1"); int maclength = 4;