Thread View: news.software.nntp
2 messages
2 total messages
Started by Paul Gregg
Tue, 23 Dec 1997 00:00
nntpsend/innxmit & source IP interface
Author: Paul Gregg
Date: Tue, 23 Dec 1997 00:00
Date: Tue, 23 Dec 1997 00:00
15 lines
1109 bytes
1109 bytes
I have an INN server running on a non-standard port (for various reasons) on a machine with approximately 100 local IP interfaces (i.e. it has a lot of IP addresses being used for Virtual hosting). One of these IPs is 'news.tibus.net', but the innxmit/nntpsend connects to remote machines from sparc.tibus.net. How can I force innxmit to connect from news.tibus.net when sending its outgoing spools ? Paul. To reply via email, unblackhole my address.
Re: nntpsend/innxmit & source IP interface
Author: Andrew A. Vasilyev
Date: Wed, 24 Dec 1997 00:00
Date: Wed, 24 Dec 1997 00:00
181 lines
5127 bytes
5127 bytes
Paul Gregg <pgregg@blackhole.nyx.net> wrote:
PG> One of these IPs is 'news.tibus.net', but the innxmit/nntpsend connects
PG> to remote machines from sparc.tibus.net.
PG> How can I force innxmit to connect from news.tibus.net when sending its
PG> outgoing spools ?
Try the following patch (add by hands not by patch -p :)),
compile with "-DNNTP_SOURCE" in lib/Makefile.
Usage: innxmit flags -F news.tibus.net host file
I use this one (together with the similar for innfeed) for
about half of a year without any pain. Suggested to inn-workers
without any result. :((
________
ANDY
*** inn-1.7.2/backends/innxmit.c Sat Dec 6 01:42:12 1997
--- inn/backends/innxmit.c Sat Jul 26 06:34:31 1997
***************
*** 1132,1138 ****
Usage()
{
(void)fprintf(stderr,
! "Usage: innxmit [-a] [-c] [-d] [-M] [-N] [-p] [-r] [-s] [-S] [-t#] [-T#] host file\n");
exit(1);
}
--- 1141,1147 ----
Usage()
{
(void)fprintf(stderr,
! "Usage: innxmit [-a] [-c] [-d] [-M] [-N] [-p] [-r] [-s] [-S] [-t#] [-T#] host file\n");
exit(1);
}
***************
*** 1160,1165 ****
--- 1169,1175 ----
unsigned int ConnectTimeout;
unsigned int TotalTimeout;
extern char *nntp_port;
+ extern char *nntp_host;
/* Set defaults. */
ConnectTimeout = 0;
***************
*** 1168,1178 ****
(void)umask(NEWSUMASK);
/* Parse JCL. */
! while ((i = getopt(ac, av, "lA:acdMNprsSt:T:vP:")) != EOF)
switch (i) {
default:
Usage();
/* NOTREACHED */
case 'A':
AltSpool = optarg;
AltPath = NEW(char, SPOOLNAMEBUFF + strlen(AltSpool));
--- 1178,1193 ----
(void)umask(NEWSUMASK);
/* Parse JCL. */
! while ((i = getopt(ac, av, "lA:acdMNprsSt:T:vP:F:")) != EOF)
switch (i) {
default:
Usage();
/* NOTREACHED */
+
+ case 'F': /* Source hostname --Andy */
+ nntp_host = optarg ;
+ break ;
+
case 'A':
AltSpool = optarg;
AltPath = NEW(char, SPOOLNAMEBUFF + strlen(AltSpool));
*** inn-1.7.2/lib/remopen.c Sat Dec 6 01:42:12 1997
--- inn/lib/remopen.c Mon Apr 21 04:39:26 1997
***************
*** 15,20 ****
--- 15,21 ----
#include "nntp.h"
#include "paths.h"
#include "libinn.h"
+ #include "macros.h"
#if !defined(ntohs) && !defined(NETSWAP)
***************
*** 26,31 ****
--- 27,37 ----
#endif /* !defined(ntohs) && !defined(NETSWAP) */
char *nntp_port = NULL;
+ /* To set the outgoing address exactly */
+ #define NNTP_SOURCE
+ #ifdef NNTP_SOURCE
+ char *nntp_host = NULL;
+ #endif
/*
** Open a connection to an NNTP server and create stdio FILE's for talking
***************
*** 52,57 ****
--- 58,77 ----
struct in_addr quadaddr;
struct sockaddr_in server;
+ #ifdef NNTP_SOURCE
+ char *ph_addr;
+ {
+ struct hostent *host;
+
+ if ( nntp_host &&
+ (host = gethostbyname(nntp_host)) != NULL &&
+ (ph_addr = (char *)malloc(host->h_length)) != NULL)
+ memcpy(ph_addr, host->h_addr, host->h_length);
+ else
+ ph_addr = NULL;
+ }
+ #endif
+
buff = errbuff ? errbuff : mybuff;
*buff = '\0';
quadaddr.s_addr = inet_addr(p);
***************
*** 93,98 ****
--- 113,132 ----
/* Make a socket and try to connect. */
if ((i = socket(hp->h_addrtype, SOCK_STREAM, 0)) < 0)
break;
+
+ #ifdef NNTP_SOURCE
+ if (ph_addr) {
+ struct sockaddr_in server_a;
+
+ (void)memset((POINTER)&server_a, 0, sizeof server_a);
+ server_a.sin_family = hp->h_addrtype;
+ (void)memcpy(&server_a.sin_addr, ph_addr, sizeof(server_a.sin_addr));
+
+ if(bind(i, (struct sockaddr *)&server_a, sizeof server_a) < 0)
+ /* fprintf(stderr, "bind() = %d\n", errno) */ ;
+ }
+ #endif
+
/* Copy the address via inline memcpy:
* (void)memcpy((POINTER)&server.sin_addr, (POINTER)*ap,
(int)hp->h_length); */
***************
*** 134,142 ****
errno = oerrno;
continue;
}
return 0;
}
!
return -1;
}
--- 168,183 ----
errno = oerrno;
continue;
}
+ #ifdef NNTP_SOURCE
+ if (ph_addr)
+ DISPOSE(ph_addr);
+ #endif
return 0;
}
! #ifdef NNTP_SOURCE
! if (ph_addr)
! DISPOSE(ph_addr);
! #endif
return -1;
}
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