From: Guus Sliepen Date: Fri, 1 Mar 2002 15:14:29 +0000 (+0000) Subject: Check if BindToDevice and PriorityInheritance are supported. X-Git-Tag: release-1.0pre6~58 X-Git-Url: https://tinc-vpn.org/git/browse?a=commitdiff_plain;h=0c16add71c6432c882c6d8f538a4b2db0026ec24;p=tinc Check if BindToDevice and PriorityInheritance are supported. --- diff --git a/po/nl.po b/po/nl.po index 65d44258..64e6452b 100644 --- a/po/nl.po +++ b/po/nl.po @@ -5,8 +5,8 @@ msgid "" msgstr "" "Project-Id-Version: tinc 1.0-cvs\n" -"POT-Creation-Date: 2002-03-01 15:22+0100\n" -"PO-Revision-Date: 2002-03-01 14:19+0100\n" +"POT-Creation-Date: 2002-03-01 16:10+0100\n" +"PO-Revision-Date: 2002-03-01 16:10+0100\n" "Last-Translator: Guus Sliepen \n" "Language-Team: Dutch \n" "MIME-Version: 1.0\n" @@ -196,7 +196,7 @@ msgstr "%s (%s) antwoordde niet op ping" msgid "Timeout from %s (%s) during authentication" msgstr "Timeout van %s (%s) tijdens authenticatie" -#: src/net.c:314 src/net_socket.c:246 +#: src/net.c:314 src/net_socket.c:254 #, c-format msgid "Error while connecting to %s (%s): %s" msgstr "Fout tijdens schrijven naar %s (%s): %s" @@ -253,69 +253,69 @@ msgstr "" msgid "Error while compressing packet to %s (%s)" msgstr "Fout tijdens comprimeren pakket naar %s (%s)" -#: src/net_packet.c:268 +#: src/net_packet.c:269 #, c-format msgid "Setting outgoing packet priority to %d" msgstr "Instellen prioriteit uitgaand pakket op %d" #. SO_PRIORITY doesn't seem to work -#: src/net_packet.c:270 src/net_setup.c:479 src/net_socket.c:99 -#: src/net_socket.c:138 src/net_socket.c:165 src/process.c:258 +#: src/net_packet.c:271 src/net_setup.c:483 src/net_socket.c:99 +#: src/net_socket.c:145 src/net_socket.c:172 src/process.c:258 #: src/process.c:293 #, c-format msgid "System call `%s' failed: %s" msgstr "Systeemaanroep `%s' mislukte: %s" -#: src/net_packet.c:275 +#: src/net_packet.c:277 #, c-format msgid "Error sending packet to %s (%s): %s" msgstr "Fout tijdens verzenden pakket naar %s (%s): %s" -#: src/net_packet.c:292 +#: src/net_packet.c:294 #, c-format msgid "Sending packet of %d bytes to %s (%s)" msgstr "Verzending pakket van %d bytes naar %s (%s)" -#: src/net_packet.c:299 +#: src/net_packet.c:301 msgid "Packet is looping back to us!" msgstr "Pakket komt terug naar ons!" -#: src/net_packet.c:308 +#: src/net_packet.c:310 #, c-format msgid "Node %s (%s) is not reachable" msgstr "Node %s (%s) is niet bereikbaar" -#: src/net_packet.c:316 +#: src/net_packet.c:318 #, c-format msgid "Sending packet to %s via %s (%s)" msgstr "Verzending pakket naar %s via %s (%s)" -#: src/net_packet.c:336 +#: src/net_packet.c:338 #, c-format msgid "Broadcasting packet of %d bytes from %s (%s)" msgstr "Verspreiding pakket van %d bytes van %s (%s)" -#: src/net_packet.c:353 +#: src/net_packet.c:355 #, c-format msgid "Flushing queue for %s (%s)" msgstr "Legen van wachtrij voor %s (%s)" -#: src/net_packet.c:375 +#: src/net_packet.c:377 #, c-format msgid "This is a bug: %s:%d: %d:%s" msgstr "Dit is een programmeerfout: %s:%d: %d:%s" -#: src/net_packet.c:382 +#: src/net_packet.c:384 #, c-format msgid "Incoming data socket error: %s" msgstr "Fout op socket voor inkomend verkeer: %s" -#: src/net_packet.c:388 +#: src/net_packet.c:390 #, c-format msgid "Receiving packet failed: %s" msgstr "Ontvangst pakket mislukt: %s" -#: src/net_packet.c:397 +#: src/net_packet.c:399 #, c-format msgid "Received UDP packet from unknown source %s" msgstr "Ontvangst UDP pakket van onbekende oorsprong %s" @@ -369,44 +369,48 @@ msgstr "Ongeldig publiek/priv msgid "Invalid routing mode!" msgstr "Ongeldige routing modus!" -#: src/net_setup.c:338 +#: src/net_setup.c:332 +msgid "PriorityInheritance not supported on this platform" +msgstr "PriorityInheritance wordt niet ondersteund op dit platform" + +#: src/net_setup.c:342 msgid "Bogus maximum timeout!" msgstr "Onzinnige maximum timeout!" -#: src/net_setup.c:355 +#: src/net_setup.c:359 msgid "Invalid address family!" msgstr "Ongeldige adresfamilie!" -#: src/net_setup.c:377 +#: src/net_setup.c:381 msgid "Unrecognized cipher type!" msgstr "Onbekend cipher type!" -#: src/net_setup.c:412 +#: src/net_setup.c:416 msgid "Unrecognized digest type!" msgstr "Onbekend digest type!" -#: src/net_setup.c:428 +#: src/net_setup.c:432 msgid "MAC length exceeds size of digest!" msgstr "MAC lengte is groter dan dat van digest!" -#: src/net_setup.c:433 +#: src/net_setup.c:437 msgid "Bogus MAC length!" msgstr "Onzinnige MAC lengte!" -#: src/net_setup.c:449 +#: src/net_setup.c:453 msgid "Bogus compression level!" msgstr "Onzinnig compressieniveau!" -#: src/net_setup.c:494 +#: src/net_setup.c:498 #, c-format msgid "Listening on %s" msgstr "Luisterend op %s" -#: src/net_setup.c:504 +#: src/net_setup.c:508 msgid "Ready" msgstr "Gereed" -#: src/net_setup.c:507 +#: src/net_setup.c:511 msgid "Unable to create any listening socket!" msgstr "Kon geen enkele luistersocket aanmaken!" @@ -415,82 +419,86 @@ msgstr "Kon geen enkele luistersocket aanmaken!" msgid "Creating metasocket failed: %s" msgstr "Aanmaak van metasocket mislukt: %s" -#: src/net_socket.c:120 src/net_socket.c:179 +#: src/net_socket.c:125 src/net_socket.c:187 #, c-format msgid "Can't bind to interface %s: %s" msgstr "Kan niet aan interface %s binden: %s" -#: src/net_socket.c:130 +#: src/net_socket.c:129 +msgid "BindToDevice not supported on this platform" +msgstr "BindToDevice wordt niet ondersteund op dit platform" + +#: src/net_socket.c:137 #, c-format msgid "Can't bind to %s/tcp: %s" msgstr "Kan niet aan %s/tcp binden: %s" -#: src/net_socket.c:157 +#: src/net_socket.c:164 #, c-format msgid "Creating UDP socket failed: %s" msgstr "Aanmaak UDP socket mislukte: %s" -#: src/net_socket.c:189 +#: src/net_socket.c:197 #, c-format msgid "Can't bind to %s/udp: %s" msgstr "Kan niet aan %s/udp binden: %s" -#: src/net_socket.c:212 +#: src/net_socket.c:220 #, c-format msgid "Trying to re-establish outgoing connection in %d seconds" msgstr "Poging tot herstellen van uitgaande verbinding over %d seconden" -#: src/net_socket.c:221 src/net_socket.c:316 +#: src/net_socket.c:229 src/net_socket.c:324 #, c-format msgid "Trying to connect to %s (%s)" msgstr "Poging tot verbinden met %s (%s)" -#: src/net_socket.c:227 src/net_socket.c:323 +#: src/net_socket.c:235 src/net_socket.c:331 #, c-format msgid "Creating socket for %s failed: %s" msgstr "Aanmaken socket voor %s mislukt: %s" -#: src/net_socket.c:251 src/net_socket.c:261 +#: src/net_socket.c:259 src/net_socket.c:269 #, c-format msgid "Connected to %s (%s)" msgstr "Verbonden met %s (%s)" -#: src/net_socket.c:280 +#: src/net_socket.c:288 #, c-format msgid "Could not set up a meta connection to %s" msgstr "Kon geen metaverbinding aangaan met %s" -#: src/net_socket.c:344 +#: src/net_socket.c:352 #, c-format msgid "fcntl for %s: %s" msgstr "fcntl voor %s: %s" -#: src/net_socket.c:362 +#: src/net_socket.c:370 #, c-format msgid "%s: %s" msgstr "%s: %s" -#: src/net_socket.c:383 +#: src/net_socket.c:391 #, c-format msgid "Already connected to %s" msgstr "Reeds verbonden met %s" -#: src/net_socket.c:402 +#: src/net_socket.c:410 #, c-format msgid "No address specified for %s" msgstr "Geen adres gespecificeerd voor %s" -#: src/net_socket.c:429 +#: src/net_socket.c:437 #, c-format msgid "Accepting a new connection failed: %s" msgstr "Aanname van nieuwe verbinding is mislukt: %s" -#: src/net_socket.c:445 +#: src/net_socket.c:453 #, c-format msgid "Connection from %s" msgstr "Verbinding van %s" -#: src/net_socket.c:467 +#: src/net_socket.c:475 #, c-format msgid "Invalid name for outgoing connection in %s line %d" msgstr "Ongeldige naam voor uitgaande verbinding in %s regel %d" @@ -1033,17 +1041,17 @@ msgstr "Installeren van signaal afhandelaar voor signaal %d (%s) faalde: %s\n" msgid "Learned new MAC address %hx:%hx:%hx:%hx:%hx:%hx" msgstr "Nieuw MAC adres %hx:%hx:%hx:%hx:%hx:%hx geleerd" -#: src/route.c:104 +#: src/route.c:105 #, c-format msgid "MAC address %hx:%hx:%hx:%hx:%hx:%hx expired" msgstr "MAC adres %hx:%hx:%hx:%hx:%hx:%hx verlopen" -#: src/route.c:149 +#: src/route.c:150 #, c-format msgid "Cannot route packet: unknown IPv4 destination address %d.%d.%d.%d" msgstr "Kan pakket niet routeren: onbekend IPv4 doeladres %d.%d.%d.%d" -#: src/route.c:169 +#: src/route.c:170 #, c-format msgid "" "Cannot route packet: unknown IPv6 destination address %hx:%hx:%hx:%hx:%hx:%" @@ -1052,16 +1060,16 @@ msgstr "" "Kan pakket niet routeren: onbekend IPv6 doeladres %hx:%hx:%hx:%hx:%hx:%hx:%" "hx:%hx" -#: src/route.c:213 +#: src/route.c:214 msgid "Cannot route packet: received unknown type ARP request" msgstr "Kan pakket niet routeren: ontvangst van onbekend type ARP verzoek" -#: src/route.c:226 +#: src/route.c:227 #, c-format msgid "Cannot route packet: ARP request for unknown address %d.%d.%d.%d" msgstr "Kan pakket niet routeren: ARP verzoek voor onbekend adres %d.%d.%d.%d" -#: src/route.c:278 +#: src/route.c:279 #, c-format msgid "Cannot route packet: unknown type %hx" msgstr "Kan pakket niet routeren: onbekend type %hx" diff --git a/src/net_packet.c b/src/net_packet.c index bffe4a7f..48c429ab 100644 --- a/src/net_packet.c +++ b/src/net_packet.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: net_packet.c,v 1.1.2.7 2002/03/01 14:09:31 guus Exp $ + $Id: net_packet.c,v 1.1.2.8 2002/03/01 15:14:29 guus Exp $ */ #include "config.h" @@ -261,6 +261,7 @@ cp /* Send the packet */ +#if defined(SOL_IP) && defined(IP_TOS) if(priorityinheritance && origpriority != priority) { priority = origpriority; @@ -269,6 +270,7 @@ cp if(setsockopt(udp_socket[0], SOL_IP, IP_TOS, &priority, sizeof(priority))) /* SO_PRIORITY doesn't seem to work */ syslog(LOG_ERR, _("System call `%s' failed: %s"), "setsockopt", strerror(errno)); } +#endif if((sendto(udp_socket[0], (char *)&inpkt->seqno, inpkt->len, 0, &(n->address.sa), SALEN(n->address.sa))) < 0) { diff --git a/src/net_setup.c b/src/net_setup.c index f8a8b99b..77e7a7c9 100644 --- a/src/net_setup.c +++ b/src/net_setup.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: net_setup.c,v 1.1.2.8 2002/03/01 14:09:31 guus Exp $ + $Id: net_setup.c,v 1.1.2.9 2002/03/01 15:14:29 guus Exp $ */ #include "config.h" @@ -327,6 +327,10 @@ cp routing_mode = RMODE_ROUTER; get_config_bool(lookup_config(config_tree, "PriorityInheritance"), &priorityinheritance); +#if !defined(SOL_IP) || !defined(IP_TOS) + if(priorityinheritance) + syslog(LOG_WARNING, _("PriorityInheritance not supported on this platform")); +#endif if(!get_config_int(lookup_config(config_tree, "MACExpire"), &macexpire)) macexpire= 600; diff --git a/src/net_socket.c b/src/net_socket.c index 63760afb..cc799264 100644 --- a/src/net_socket.c +++ b/src/net_socket.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: net_socket.c,v 1.1.2.7 2002/03/01 14:09:31 guus Exp $ + $Id: net_socket.c,v 1.1.2.8 2002/03/01 15:14:29 guus Exp $ */ #include "config.h" @@ -81,7 +81,7 @@ int setup_listen_socket(sockaddr_t *sa) int nfd, flags; char *addrstr; int option; -#ifdef HAVE_LINUX +#if defined(SOL_SOCKET) && defined(SO_BINDTODEVICE) char *interface; struct ifreq ifr; #endif @@ -104,14 +104,19 @@ cp option = 1; setsockopt(nfd, SOL_SOCKET, SO_REUSEADDR, &option, sizeof(option)); -#ifdef HAVE_LINUX + +#if defined(SOL_TCP) && defined(TCP_NODELAY) setsockopt(nfd, SOL_TCP, TCP_NODELAY, &option, sizeof(option)); +#endif +#if defined(SOL_IP) && defined(IP_TOS) && defined(IPTOS_LOWDELAY) option = IPTOS_LOWDELAY; setsockopt(nfd, SOL_IP, IP_TOS, &option, sizeof(option)); +#endif if(get_config_string(lookup_config(config_tree, "BindToInterface"), &interface)) { +#if defined(SOL_SOCKET) && defined(SO_BINDTODEVICE) memset(&ifr, 0, sizeof(ifr)); strncpy(ifr.ifr_ifrn.ifrn_name, interface, IFNAMSIZ); if(setsockopt(nfd, SOL_SOCKET, SO_BINDTODEVICE, &ifr, sizeof(ifr))) @@ -120,8 +125,10 @@ cp syslog(LOG_ERR, _("Can't bind to interface %s: %s"), interface, strerror(errno)); return -1; } - } +#else + syslog(LOG_WARNING, _("BindToDevice not supported on this platform")); #endif + } if(bind(nfd, &sa->sa, SALEN(sa->sa))) { @@ -147,7 +154,7 @@ int setup_vpn_in_socket(sockaddr_t *sa) int nfd, flags; char *addrstr; int option; -#ifdef HAVE_LINUX +#if defined(SOL_SOCKET) && defined(SO_BINDTODEVICE) char *interface; struct ifreq ifr; #endif @@ -168,7 +175,8 @@ cp option = 1; setsockopt(nfd, SOL_SOCKET, SO_REUSEADDR, &option, sizeof(option)); -#ifdef HAVE_LINUX + +#if defined(SOL_SOCKET) && defined(SO_BINDTODEVICE) if(get_config_string(lookup_config(config_tree, "BindToInterface"), &interface)) { memset(&ifr, 0, sizeof(ifr));