[PATCH] force-ipv4 config option for innfeed

Marco d'Itri md at Linux.IT
Sat Aug 26 21:10:03 UTC 2006


diff -ruN inn-2.4.3.orig/doc/man/innfeed.conf.5 inn-2.4.3/doc/man/innfeed.conf.5
--- inn-2.4.3.orig/doc/man/innfeed.conf.5	2006-03-20 05:14:57.000000000 +0100
+++ inn-2.4.3/doc/man/innfeed.conf.5	2006-08-18 10:54:37.000000000 +0200
@@ -459,6 +459,10 @@
 This key requires a positive integer value. It defines the tcp/ip port
 number to use when connecting to the remote.
 .TP
+.B force-ipv4
+This key requires a boolean value. By default it is set to false.
+If it is set to true, innfeed will not try to use IPv6 with that peer.
+.TP
 .B drop-deferred
 This key requires a boolean value. By default it is set to false. When
 set to true, and a peer replies with code 431 or 436 (try again later) just
diff -ruN inn-2.4.3.orig/innfeed/host.c inn-2.4.3/innfeed/host.c
--- inn-2.4.3.orig/innfeed/host.c	2006-08-18 10:58:11.000000000 +0200
+++ inn-2.4.3/innfeed/host.c	2006-08-18 10:58:04.000000000 +0200
@@ -87,6 +87,7 @@
   unsigned int absMaxConnections;
   unsigned int maxChecks;
   unsigned short portNum;
+  bool forceIPv4;
   unsigned int closePeriod;
   unsigned int dynamicMethod;
   bool wantStreaming;
@@ -498,6 +499,7 @@
       params->absMaxConnections=MAX_CXNS;
       params->maxChecks=MAX_Q_SIZE;
       params->portNum=PORTNUM;
+      params->forceIPv4=FORCE_IPv4;
       params->closePeriod=CLOSE_PERIOD;
       params->dynamicMethod=METHOD_STATIC;
       params->wantStreaming=STREAM;
@@ -1123,9 +1125,13 @@
       int gai_ret;
       struct addrinfo *res, *p;
       struct addrinfo template = {0};
-      template.ai_family = PF_UNSPEC;
       template.ai_socktype = SOCK_STREAM;
 
+      if (host->params->forceIPv4)
+        template.ai_family = PF_INET;
+      else
+        template.ai_family = PF_UNSPEC;
+
       gai_ret = getaddrinfo(host->params->ipName, NULL, &template, &res);
       if( gai_ret != 0 || res == NULL )
 	{
@@ -2676,6 +2682,7 @@
   GETREAL(s,fp,"no-check-low",0.0,100.0,REQ,p->lowPassLow, inherit);
   GETREAL(s,fp,"no-check-filter",0.1,DBL_MAX,REQ,p->lowPassFilter, inherit);
   GETINT(s,fp,"port-number",0,LONG_MAX,REQ,p->portNum, inherit);
+  GETBOOL(s,fp,"force-ipv4",NOTREQ,p->forceIPv4,inherit);
   GETINT(s,fp,"backlog-limit",0,LONG_MAX,REQ,p->backlogLimit, inherit);
 
   if (findValue (s,"backlog-factor",inherit) == NULL &&
diff -ruN inn-2.4.3.orig/innfeed/innfeed.h inn-2.4.3/innfeed/innfeed.h
--- inn-2.4.3.orig/innfeed/innfeed.h	2006-03-20 05:14:57.000000000 +0100
+++ inn-2.4.3/innfeed/innfeed.h	2006-08-18 10:54:37.000000000 +0200
@@ -62,6 +62,7 @@
 #define NOCHECKHIGH 		95.0 		/* no-check-high */
 #define NOCHECKLOW 		90.0 		/* no-check-low */
 #define PORTNUM 		119 		/* port-number */
+#define FORCE_IPv4		false		/* force using IPv4 */
 #define BLOGLIMIT		0 		/* backlog-limit */
 #define LIMIT_FUDGE 		1.10 		/* backlog-factor */
 #define BLOGLIMIT_HIGH		0 		/* backlog-limit-high */
diff -ruN inn-2.4.3.orig/samples/innfeed.conf inn-2.4.3/samples/innfeed.conf
--- inn-2.4.3.orig/samples/innfeed.conf	2006-03-20 05:14:57.000000000 +0100
+++ inn-2.4.3/samples/innfeed.conf	2006-08-18 10:54:37.000000000 +0200
@@ -56,6 +56,7 @@
 no-check-low:			90.0
 no-check-filter:		50.0
 port-number:			119
+force-ipv4:			false
 drop-deferred:			false
 min-queue-connection:		false
 backlog-limit:			0

-- 
ciao,
Marco


More information about the inn-workers mailing list