mirror of
https://gitlab.isc.org/isc-projects/dhcp
synced 2025-09-04 00:05:30 +00:00
Use interface_allocate() to allocate interfaces.
This commit is contained in:
@@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char ocopyright[] =
|
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 */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include "dhcpd.h"
|
#include "dhcpd.h"
|
||||||
@@ -146,19 +146,24 @@ int main (argc, argv, envp)
|
|||||||
no_daemon = 1;
|
no_daemon = 1;
|
||||||
} else if (!strcmp (argv [i], "-i")) {
|
} else if (!strcmp (argv [i], "-i")) {
|
||||||
struct interface_info *tmp =
|
struct interface_info *tmp =
|
||||||
((struct interface_info *)
|
(struct interface_info *)0;
|
||||||
dmalloc (sizeof *tmp, MDL));
|
status = interface_allocate (&tmp, MDL);
|
||||||
if (!tmp)
|
if (status != ISC_R_SUCCESS)
|
||||||
log_fatal ("Insufficient memory to %s %s",
|
log_fatal ("%s: interface_allocate: %s",
|
||||||
"record interface", argv [i]);
|
argv [i],
|
||||||
|
isc_result_totext (status));
|
||||||
if (++i == argc) {
|
if (++i == argc) {
|
||||||
usage ();
|
usage ();
|
||||||
}
|
}
|
||||||
memset (tmp, 0, sizeof *tmp);
|
|
||||||
strcpy (tmp -> name, argv [i]);
|
strcpy (tmp -> name, argv [i]);
|
||||||
tmp -> next = interfaces;
|
|
||||||
tmp -> flags = INTERFACE_REQUESTED;
|
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")) {
|
} else if (!strcmp (argv [i], "-q")) {
|
||||||
quiet = 1;
|
quiet = 1;
|
||||||
quiet_interface_discovery = 1;
|
quiet_interface_discovery = 1;
|
||||||
|
Reference in New Issue
Block a user