* Re: inet patches for multihomed hosts (and IP aliasing)
@ 1996-04-22 10:18 Nigel Metheringham
0 siblings, 0 replies; 3+ messages in thread
From: Nigel Metheringham @ 1996-04-22 10:18 UTC (permalink / raw)
You can do the multihomed stuff using tcpd under inetd.
However the latest varient of xinetd for Linux handles multi-homing
and a few other things. It builds and runs on AXP (Red Hat 2.1), but
the debugging doesn't work - I haven't had time to chase this down.
It should be available in
ftp.telebase.com/pub/security/
Nigel.
--
[ Nigel.Metheringham@theplanet.net - Unix Applications Engineer ]
[ *Views expressed here are personal and not supported by PLAnet* ]
[ PLAnet Online : The White House Tel : +44 113 2345566 x 612 ]
[ Melbourne Street, Leeds LS2 7PS UK. Fax : +44 113 2345656 ]
^ permalink raw reply [flat|nested] 3+ messages in thread
* inet patches for multihomed hosts (and IP aliasing)
@ 1996-04-21 20:42 Eric Smith
1996-04-21 20:53 ` Erik Troan
0 siblings, 1 reply; 3+ messages in thread
From: Eric Smith @ 1996-04-21 20:42 UTC (permalink / raw)
This isn't really Alpha-specific (or even Linux-specific) but since I got it
working on Red Hat Linux AXP 2.1, I thought I'd share it in case anyone else
is trying to use an Alpha as an internet server platform.
I upgraded my server machine to the 1.3.90 and turned on IP aliasing. The
Apache web server can be easily configured to serve separate directory
heirarchies to the multiple IP addresses. However, I also want different
FTP directories, and I don't want other services (such as Telnet) showing up
on all the IP addresses.
I came up with a patch (below) to inetd, which adds the ability to specify
a secific host name or address for each service.
Note that this doesn't solve the problem for other services such as
named, since they aren't started by inetd. Rather than patch all such
programs, I think I will hack the library so that when bind() is called,
if the IP addrees is 0 and an environment variable (FORCE_IP_ADDR) is
defined, that the value of the latter gets substituted.
Cheers,
Eric
-----------------------------------------------------------------------------
--- inetd.c.orig Mon May 23 02:04:45 1994
+++ inetd.c Sun Apr 21 13:37:11 1996
@@ -87,6 +87,29 @@
* Comment lines are indicated by a `#' in column 1.
*/
+#ifdef MULTIHOME
+/*
+ * Multihome patch by Eric Smith, 4/19/96
+ *
+ * With this patch enabled, the first field on a line (for non-RPC services)
+ * may be of the format host_name:service_name. On a multi-homed host, this
+ * is useful to restrict a service to accept connections on only one IP
+ * address, or to run different instances of a service on different IP
+ * addresses.
+ *
+ * If the host name is given as a DNS name, it has to be resolved when inetd
+ * is started (and restarted). On many systems DNS isn't operational that
+ * early in the boot process; in this case there should be /etc/hosts entries.
+ * Alternatively the host can be specified using dotted decimal notation.
+ *
+ * If no colon is present, or if the host is specified as "*", the original
+ * behavior of wildcarding the address is used.
+ *
+ * This patch has been tested on a Digital UDB (aka Multia) running
+ * Red Hat Linux/AXP 2.1 and Linux kernel version 1.3.90.
+ */
+#endif /* MULTIHOME */
+
/*
* Here's the scoop concerning the user.group feature:
*
@@ -185,6 +208,9 @@
#endif
struct servtab {
+#ifdef MULTIHOME
+ char *se_host; /* hostname */
+#endif /* MULTIHOME */
char *se_service; /* name of service */
int se_socktype; /* type of socket to use */
int se_family; /* address family */
@@ -272,6 +298,32 @@
}
#endif
+
+#ifdef MULTIHOME
+void get_host_addr (char *cp, struct in_addr *a)
+{
+ int tmp;
+ struct hostent *host;
+
+ a->s_addr = 0;
+
+ if ((!cp) || (*cp == '\0') || (strcmp (cp, "*") == 0))
+ a->s_addr = 0;
+ else if ((tmp = inet_addr(cp)) != -1)
+ a->s_addr = tmp;
+ else if (host = gethostbyname (cp))
+ {
+ if (host->h_addrtype == AF_INET)
+ memcpy (a, host->h_addr, sizeof (struct in_addr));
+ else
+ syslog(LOG_WARNING, "non-IP host '%s'\n", cp);
+ }
+ else
+ syslog(LOG_WARNING, "can't resolve host '%s'\n", cp);
+ return;
+}
+#endif /* MULTIHOME */
+
main(argc, argv, envp)
int argc;
char *argv[], *envp[];
@@ -617,6 +669,9 @@
case AF_INET:
sep->se_ctrladdr_in.sin_family = AF_INET;
sep->se_ctrladdr_size = sizeof sep->se_ctrladdr_in;
+#ifdef MULTIHOME
+ get_host_addr (sep->se_host, & sep->se_ctrladdr_in.sin_addr);
+#endif /* MULTIHOME */
if (isrpcservice(sep)) {
struct rpcent *rp;
@@ -880,6 +935,9 @@
register struct servtab *sep = &serv;
int argc;
char *cp, *arg, *newstr();
+#ifdef MULTIHOME
+ char *cp2;
+#endif /* MULTIHOME */
more:
#ifdef MULOG
@@ -918,6 +976,16 @@
return ((struct servtab *)0);
bzero((char *)sep, sizeof *sep);
sep->se_service = newstr(skip(&cp));
+#ifdef MULTIHOME
+ if (cp2 = strchr (sep->se_service, ':'))
+ {
+ sep->se_host = sep->se_service;
+ sep->se_service = newstr (cp2+1);
+ *cp2 = '\0';
+ }
+ else
+ sep->se_host = newstr ("*");
+#endif /* MULTIHOME */
arg = skip(&cp);
if (arg == NULL)
goto more;
@@ -1049,6 +1117,10 @@
{
int i;
+#ifdef MULTIHOME
+ if (cp->se_host)
+ free(cp->se_host);
+#endif MULTIHOME
if (cp->se_service)
free(cp->se_service);
if (cp->se_proto)
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: inet patches for multihomed hosts (and IP aliasing)
1996-04-21 20:42 Eric Smith
@ 1996-04-21 20:53 ` Erik Troan
0 siblings, 0 replies; 3+ messages in thread
From: Erik Troan @ 1996-04-21 20:53 UTC (permalink / raw)
On Sun, 21 Apr 1996, Eric Smith wrote:
> I upgraded my server machine to the 1.3.90 and turned on IP aliasing. The
> Apache web server can be easily configured to serve separate directory
> heirarchies to the multiple IP addresses. However, I also want different
> FTP directories, and I don't want other services (such as Telnet) showing up
> on all the IP addresses.
For the record, tha leatest wu-ftpd RPM in the devel tree supports multi
homed hosts.
Erik
-------------------------------------------------------------------------------
Always hoped that I'd be an apostle. Knew that I would make it if I tried.
Then when we retire we can write the gospels so they'll all talk about
us when we die. - "The Last Supper" from Jesus Christ Superstar
| Erik Troan = http://sunsite.unc.edu/ewt/ = ewt@sunsite.unc.edu |
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1996-04-22 10:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-04-22 10:18 inet patches for multihomed hosts (and IP aliasing) Nigel Metheringham
-- strict thread matches above, loose matches on Subject: below --
1996-04-21 20:42 Eric Smith
1996-04-21 20:53 ` Erik Troan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox