summaryrefslogtreecommitdiff
path: root/relay
diff options
context:
space:
mode:
authorTed Lemon <source@isc.org>2000-09-29 18:14:00 +0000
committerTed Lemon <source@isc.org>2000-09-29 18:14:00 +0000
commita9ef57b1e52126919c1beca5a73f8886f8554a75 (patch)
treef877c9c2d2d6854f55bc678423655eea0db07eef /relay
parenta5d575bc86464543446e24d7c089b0363b00a399 (diff)
downloadisc-dhcp-a9ef57b1e52126919c1beca5a73f8886f8554a75.tar.gz
Use interface_allocate() to allocate interfaces.
Diffstat (limited to 'relay')
-rw-r--r--relay/dhcrelay.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c
index 5b347cf8..4a34b66a 100644
--- a/relay/dhcrelay.c
+++ b/relay/dhcrelay.c
@@ -43,7 +43,7 @@
#ifndef lint
static char ocopyright[] =
-"$Id: dhcrelay.c,v 1.45 2000/09/27 19:35:56 mellon Exp $ Copyright (c) 1997-2000 Internet Software Consortium. All rights reserved.\n";
+"$Id: dhcrelay.c,v 1.46 2000/09/29 18:14:00 mellon Exp $ Copyright (c) 1997-2000 Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -146,19 +146,24 @@ int main (argc, argv, envp)
no_daemon = 1;
} else if (!strcmp (argv [i], "-i")) {
struct interface_info *tmp =
- ((struct interface_info *)
- dmalloc (sizeof *tmp, MDL));
- if (!tmp)
- log_fatal ("Insufficient memory to %s %s",
- "record interface", argv [i]);
+ (struct interface_info *)0;
+ status = interface_allocate (&tmp, MDL);
+ if (status != ISC_R_SUCCESS)
+ log_fatal ("%s: interface_allocate: %s",
+ argv [i],
+ isc_result_totext (status));
if (++i == argc) {
usage ();
}
- memset (tmp, 0, sizeof *tmp);
strcpy (tmp -> name, argv [i]);
- tmp -> next = interfaces;
tmp -> flags = INTERFACE_REQUESTED;
- interfaces = tmp;
+ if (interfaces) {
+ interface_reference (&tmp -> next, interfaces,
+ MDL);
+ interface_dereference (&interfaces, MDL);
+ }
+ interface_reference (&interfaces, tmp, MDL);
+ interface_dereference (&tmp, MDL);
} else if (!strcmp (argv [i], "-q")) {
quiet = 1;
quiet_interface_discovery = 1;