Thread View: news.software.nntp
3 messages
3 total messages
Started by Shawn Ramsey
Thu, 03 May 2001 23:42
innfeed source address?
Author: Shawn Ramsey
Date: Thu, 03 May 2001 23:42
Date: Thu, 03 May 2001 23:42
9 lines
1205 bytes
1205 bytes
Is it possible to specify a source address when using innfeed? innxmit honors the source address specified in inn.conf, but innfeed does not. I don't see it anywhere in the man page, so im guess its not. Just thought i'd ask...
Re: innfeed source address?
Author: Peter Pramberger
Date: Mon, 07 May 2001 08:06
Date: Mon, 07 May 2001 08:06
22 lines
1806 bytes
1806 bytes
Shawn Ramsey schrieb: > > Is it possible to specify a source address when using innfeed? innxmit > honors the source address specified in inn.conf, but innfeed does not. I > don't see it anywhere in the man page, so im guess its not. Just thought i'd > ask... Have a look at the man page of innfeed.conf: bindaddress: xxx.xxx.xxx.xxx Which interface IP address innfeed should bind the local end of its connections to. If not set, innfeed defaults to letting the kernel choose this address. The default is unset. Should work at least since 2.2.2. -- Peter Pramberger (peter.pramberger@1012surf.net) Tele.Ring Telekom Service GmbH Vienna, Austria
Re: innfeed source address?
Author: those who know me have no need o...
Date: Wed, 09 May 2001 01:55
Date: Wed, 09 May 2001 01:55
254 lines
8796 bytes
8796 bytes
<3AF65782.435AF2E3@1012surf.net> divulged:
>Shawn Ramsey schrieb:
>> Is it possible to specify a source address when using innfeed?
>bindaddress: xxx.xxx.xxx.xxx
and if you need per-peer binding you might try the following, completely
untested (you own both halves if it breaks) patch:
--- configfile.h.old Thu May 3 13:27:32 2001
+++ configfile.h Mon May 8 18:24:21 2001
@@ -89,6 +89,7 @@
#define BACKLOG_LIMIT "backlog-limit"
#define INITIAL_CONNECTIONS "initial-connections"
#define IP_NAME "ip-name"
+#define BINDADDRESS "bindaddress"
#define MAX_CONNECTIONS "max-connections"
#define MAX_QUEUE_SIZE "max-queue-size"
#define NO_CHECK_HIGH "no-check-high"
--- connection.h.old Thu May 3 13:27:32 2001
+++ connection.h Mon May 8 18:30:14 2001
@@ -76,6 +76,7 @@
Connection newConnection (Host host,
u_int ident,
const char *ipname,
+ const char *bindname,
u_int artTout,
u_int portNum,
u_int respTimeout,
--- connection.c.old Thu May 3 13:27:32 2001
+++ connection.c Mon May 8 18:27:36 2001
@@ -191,6 +191,7 @@
Buffer respBuffer ; /* buffer all responses are read into */
char *ipName ; /* the ip name (possibly quad) of the remote */
+ char *bindName ; /* the ip name (possibly quad) of the local */
u_int maxCheck ; /* the max number of CHECKs to send */
u_short port ; /* the port number to use */
@@ -406,7 +407,7 @@
iv = INIT_RECON_PER ;
init_reconnect_period = (u_int) iv ;
- if (getString (topScope,"bindaddress",&sv,NO_INHERIT))
+ if (getString (topScope,BINDADDRESS,&sv,NO_INHERIT))
{
bind_addr = inet_addr(sv);
if (bind_addr == INADDR_NONE)
@@ -432,6 +433,7 @@
Connection newConnection (Host host,
u_int id,
const char *ipname,
+ const char *bindname,
u_int articleReceiptTimeout,
u_int portNum,
u_int respTimeout,
@@ -476,6 +478,9 @@
cxn->respBuffer = newBuffer (BUFFER_SIZE) ;
ASSERT (cxn->respBuffer != NULL) ;
+ if (bindname) {
+ cxn->bindName = strdup (bindname) ;
+ } else cxn->bindName = NULL ;
cxn->ipName = strdup (ipname) ;
cxn->port = portNum ;
@@ -582,6 +587,33 @@
}
/* bind to a specified virtual host */
+ if (cxn->bindName)
+ {
+ u_long bind_addr = inet_addr(cxn->bindName);
+ if (bind_addr == INADDR_NONE)
+ {
+ logOrPrint (LOG_ERR,fp,"innfeed unable to determine bind ip for peer %s",cxn->peerName) ;
+ bind_addr = INADDR_ANY;
+ }
+ else
+ {
+ memset (&cxnSelf, 0, sizeof (cxnSelf)) ;
+ cxnSelf.sin_family = AF_INET ;
+ cxnSelf.sin_port = 0 ;
+ cxnSelf.sin_addr.s_addr = bind_addr;
+ if (bind (fd, (struct sockaddr *) &cxnSelf,sizeof (cxnSelf)) < 0)
+ {
+ syslog (LOG_ERR,"bind: %m") ;
+
+ cxnSleepOrDie (cxn) ;
+
+ return false ;
+ }
+ }
+ }
+ else
+
+ /* bind to a specified virtual host */
if (bind_addr != INADDR_ANY)
{
memset (&cxnSelf, 0, sizeof (cxnSelf)) ;
@@ -1163,6 +1195,7 @@
fprintf (fp,"%s endpoint : %p\n",indent,cxn->myEp) ;
fprintf (fp,"%s state : %s\n",indent, stateToString (cxn->state)) ;
fprintf (fp,"%s ident : %d\n",indent,cxn->ident) ;
+ fprintf (fp,"%s bindaddress : %s\n", indent, (cxn->bindName)?cxn->bindName:"ANY") ;
fprintf (fp,"%s ip-name : %s\n", indent, cxn->ipName) ;
fprintf (fp,"%s port-number : %d\n",indent,cxn->port) ;
fprintf (fp,"%s max-checks : %d\n",indent,cxn->maxCheck) ;
@@ -4059,6 +4092,8 @@
cxn->ident = 0 ;
cxn->timeCon = 0 ;
+ if (cxn->bindName)
+ FREE (cxn->bindName) ;
FREE (cxn->ipName) ;
clearTimer (cxn->artReceiptTimerId) ;
--- host.c.old Thu May 3 13:27:32 2001
+++ host.c Mon May 8 18:24:12 2001
@@ -113,6 +113,7 @@
{
char *peerName;
char *ipName;
+ char *bindName;
u_int articleTimeout;
u_int responseTimeout;
u_int initialConnections;
@@ -351,6 +352,7 @@
static u_int gHostCount = 0 ;
+static u_int maxBindNameLen = 0 ;
static u_int maxIpNameLen = 0 ;
static u_int maxPeerNameLen = 0 ;
@@ -507,12 +509,15 @@
params->peerName = strdup(params->peerName);
if (params->ipName)
params->ipName = strdup(params->ipName);
+ if (params->bindName)
+ params->bindName = strdup(params->bindName);
}
else
{
/* Fill in defaults */
params->peerName=NULL;
params->ipName=NULL;
+ params->bindName=NULL;
params->articleTimeout=ARTTOUT;
params->responseTimeout=RESPTOUT;
params->initialConnections=INIT_CXNS;
@@ -548,6 +553,8 @@
FREE (params->peerName) ;
if (params->ipName)
FREE (params->ipName) ;
+ if (params->bindName)
+ FREE (params->bindName) ;
FREE (params) ;
}
@@ -563,6 +570,12 @@
h->nextIpLookup = theTime () ;
}
+ if (strcmp(h->params->bindName, params->bindName) != 0)
+ {
+ FREE (h->params->bindName) ;
+ h->params->bindName = strdup (params->bindName) ;
+ }
+
/* Put in new parameters
Unfortunately we can't blat on top of absMaxConnections
as we need to do some resizing here
@@ -670,10 +683,13 @@
params = newHostParams(defaultParams);
ASSERT(params->peerName == NULL);
ASSERT(params->ipName == NULL);
+ ASSERT(params->bindName == NULL);
ASSERT(h->params->peerName != NULL);
ASSERT(h->params->ipName != NULL);
+ ASSERT(h->params->bindName != NULL);
params->peerName = strdup(h->params->peerName);
params->ipName = strdup(h->params->ipName);
+ params->bindName = strdup(h->params->bindName);
hostReconfigure(h, params);
h->removeOnReload = true;
}
@@ -819,6 +835,7 @@
host->connections [i] =
newConnection (host, i,
host->params->ipName,
+ host->params->bindName,
host->params->articleTimeout,
host->params->portNum,
host->params->responseTimeout,
@@ -945,6 +962,7 @@
/* relies on fact listener and names are null in default*/
p->peerName=strdup(name);
p->ipName=strdup(name);
+ p->bindName=NULL;
h=newHost (listener,p);
if (h==NULL)
@@ -1119,7 +1137,9 @@
strcpy (startTime,ctime (&start)) ;
myPid = getpid() ;
}
-
+
+ if (strlen (nh->params->bindName) > maxBindNameLen)
+ maxBindNameLen = strlen (nh->params-bindName) ;
if (strlen (nh->params->ipName) > maxIpNameLen)
maxIpNameLen = strlen (nh->params->ipName) ;
if (strlen (nh->params->peerName) > maxPeerNameLen)
@@ -1252,6 +1272,7 @@
fprintf (fp,"%s peer-name : %s\n",indent,host->params->peerName) ;
fprintf (fp,"%s ip-name : %s\n",indent,host->params->ipName) ;
+ fprintf (fp,"%s bindaddress : %s\n",indent,(host->params->bindName!=NULL)?host->params->bindName:"ANY") ;
fprintf (fp,"%s abs-max-connections : %d\n",indent,
host->params->absMaxConnections) ;
fprintf (fp,"%s active-connections : %d\n",indent,host->activeCxns) ;
@@ -2521,11 +2542,17 @@
p->peerName=strdup(name);
}
- if (s != NULL)
+ if (s != NULL) {
if (getString (s,IP_NAME,&q,NO_INHERIT))
p->ipName = q ;
else
p->ipName = strdup (name) ;
+
+ if (getString (s,BINDADDRESS,&q,INHERIT))
+ p->bindName = q;
+ else
+ p->bindName = NULL;
+ }
}
@@ -2688,6 +2715,7 @@
FREE (host->cxnSleeping) ;
FREE (host->params->peerName) ;
FREE (host->params->ipName) ;
+ FREE (host->params->bindName) ;
if (host->ipAddrs)
FREE (host->ipAddrs) ;
--
okay, have a sig then
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads