Zebediah Figura z.figura12@gmail.com writes:
@@ -712,6 +712,42 @@ static int get_unix_protocol( int protocol ) } }
+static void set_dont_fragment( int fd, int level, int value ) +{
- int optname;
- if (level == IPPROTO_IP)
- {
+#ifdef IP_DONTFRAG
optname = IP_DONTFRAG;
+#elif defined(IP_MTU_DISCOVER) && defined(IP_PMTUDISC_DO) && defined(IP_PMTUDISC_DONT)
optname = IP_MTU_DISCOVER;
value = value ? IP_PMTUDISC_DO : IP_PMTUDISC_DONT;
+#else
static int once;
if (!once++)
fprintf( stderr, "IP_DONTFRAGMENT for IPv4 not supported in this platform\n" );
return;
+#endif
- }
- else
- {
+#ifdef IPV6_DONTFRAG
optname = IPV6_DONTFRAG;
+#elif defined(IPV6_MTU_DISCOVER) && defined(IPV6_PMTUDISC_DO) && defined(IPV6_PMTUDISC_DONT)
optname = IPV6_MTU_DISCOVER;
value = value ? IPV6_PMTUDISC_DO : IPV6_PMTUDISC_DONT;
+#else
static int once;
if (!once++)
fprintf( stderr, "IP_DONTFRAGMENT for IPv6 not supported in this platform\n" );
return;
+#endif
Please don't print errors from the server. If there's a need to show this to the user, it should return an error that would be checked for and printed on the client side.