#ifndef lint
static char copyright[] =
-"$Id: dispatch.c,v 1.30 1997/02/19 10:49:19 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
+"$Id: dispatch.c,v 1.31 1997/02/22 08:34:16 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
static struct timeout *free_timeouts;
static int interfaces_invalidated;
-static void got_one PROTO ((struct interface_info *));
+static void got_one PROTO ((struct interface_info *, int));
/* Use the SIOCGIFCONF ioctl to get a list of all the attached interfaces.
For each interface that's of type INET and not the loopback interface,
error ("no space to remember ifp.");
memcpy (tif, ifp, len);
tmp -> ifp = ifp;
+ tmp -> primary_address = foo.sin_addr;
}
/* Grab the address... */
wouldn't do for SysV to make networking *easy*, would it? Rant,
rant... */
-void dispatch ()
+void dispatch (parse)
+ int parse;
{
struct interface_info *l;
int nfds = 0;
for (l = interfaces; l; l = l -> next) {
if ((fds [i].revents & POLLIN)) {
fds [i].revents = 0;
- got_one (l);
+ got_one (l, parse);
if (interfaces_invalidated)
break;
}
for (l = interfaces; l; l = l -> next) {
if (!FD_ISSET (l -> rfdesc, &r))
continue;
- got_one (l);
+ got_one (l, parse);
if (interfaces_invalidated)
break;
}
}
#endif /* USE_POLL */
-static void got_one (l)
+static void got_one (l, parse)
struct interface_info *l;
+ int parse;
{
struct sockaddr_in from;
struct hardware hfrom;
if (result == 0)
return;
- ifrom.len = 4;
- memcpy (ifrom.iabuf, &from.sin_addr, ifrom.len);
+ if (parse) {
+ ifrom.len = 4;
+ memcpy (ifrom.iabuf, &from.sin_addr, ifrom.len);
- do_packet (l, packbuf, result,
- from.sin_port, ifrom, &hfrom);
+ do_packet (l, packbuf, result,
+ from.sin_port, ifrom, &hfrom);
+ } else
+ relay (l, (struct dhcp_packet *)packbuf, result);
}
void do_packet (interface, packbuf, len, from_port, from, hfrom)
#ifndef lint
static char copyright[] =
-"$Id: dispatch.c,v 1.30 1997/02/19 10:49:19 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
+"$Id: dispatch.c,v 1.31 1997/02/22 08:34:16 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
static struct timeout *free_timeouts;
static int interfaces_invalidated;
-static void got_one PROTO ((struct interface_info *));
+static void got_one PROTO ((struct interface_info *, int));
/* Use the SIOCGIFCONF ioctl to get a list of all the attached interfaces.
For each interface that's of type INET and not the loopback interface,
error ("no space to remember ifp.");
memcpy (tif, ifp, len);
tmp -> ifp = ifp;
+ tmp -> primary_address = foo.sin_addr;
}
/* Grab the address... */
wouldn't do for SysV to make networking *easy*, would it? Rant,
rant... */
-void dispatch ()
+void dispatch (parse)
+ int parse;
{
struct interface_info *l;
int nfds = 0;
for (l = interfaces; l; l = l -> next) {
if ((fds [i].revents & POLLIN)) {
fds [i].revents = 0;
- got_one (l);
+ got_one (l, parse);
if (interfaces_invalidated)
break;
}
for (l = interfaces; l; l = l -> next) {
if (!FD_ISSET (l -> rfdesc, &r))
continue;
- got_one (l);
+ got_one (l, parse);
if (interfaces_invalidated)
break;
}
}
#endif /* USE_POLL */
-static void got_one (l)
+static void got_one (l, parse)
struct interface_info *l;
+ int parse;
{
struct sockaddr_in from;
struct hardware hfrom;
if (result == 0)
return;
- ifrom.len = 4;
- memcpy (ifrom.iabuf, &from.sin_addr, ifrom.len);
+ if (parse) {
+ ifrom.len = 4;
+ memcpy (ifrom.iabuf, &from.sin_addr, ifrom.len);
- do_packet (l, packbuf, result,
- from.sin_port, ifrom, &hfrom);
+ do_packet (l, packbuf, result,
+ from.sin_port, ifrom, &hfrom);
+ } else
+ relay (l, (struct dhcp_packet *)packbuf, result);
}
void do_packet (interface, packbuf, len, from_port, from, hfrom)