mirror of
https://gitlab.isc.org/isc-projects/dhcp
synced 2025-08-30 13:57:50 +00:00
Pull up recent 2.0 changes. Add skip_to_rbrace.
This commit is contained in:
@@ -3,8 +3,8 @@
|
|||||||
Common parser code for dhcpd and dhclient. */
|
Common parser code for dhcpd and dhclient. */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium.
|
* Copyright (c) 1995, 1996, 1997, 1998, 1999
|
||||||
* All rights reserved.
|
* The Internet Software Consortium. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char copyright[] =
|
static char copyright[] =
|
||||||
"$Id: parse.c,v 1.11 1998/11/06 02:42:48 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
|
"$Id: parse.c,v 1.12 1999/02/14 18:54:03 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include "dhcpd.h"
|
#include "dhcpd.h"
|
||||||
@@ -64,10 +64,16 @@ static char copyright[] =
|
|||||||
|
|
||||||
void skip_to_semi (cfile)
|
void skip_to_semi (cfile)
|
||||||
FILE *cfile;
|
FILE *cfile;
|
||||||
|
{
|
||||||
|
skip_to_rbrace (cfile, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void skip_to_rbrace (cfile, brace_count)
|
||||||
|
FILE *cfile;
|
||||||
|
int brace_count;
|
||||||
{
|
{
|
||||||
enum dhcp_token token;
|
enum dhcp_token token;
|
||||||
char *val;
|
char *val;
|
||||||
int brace_count = 0;
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
token = peek_token (&val, cfile);
|
token = peek_token (&val, cfile);
|
||||||
@@ -281,6 +287,9 @@ void parse_hardware_param (cfile, hardware)
|
|||||||
case TOKEN_RING:
|
case TOKEN_RING:
|
||||||
hardware -> htype = HTYPE_IEEE802;
|
hardware -> htype = HTYPE_IEEE802;
|
||||||
break;
|
break;
|
||||||
|
case FDDI:
|
||||||
|
hardware -> htype = HTYPE_FDDI;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
parse_warn ("expecting a network hardware type");
|
parse_warn ("expecting a network hardware type");
|
||||||
skip_to_semi (cfile);
|
skip_to_semi (cfile);
|
||||||
@@ -306,6 +315,9 @@ void parse_hardware_param (cfile, hardware)
|
|||||||
hardware -> hlen = hlen;
|
hardware -> hlen = hlen;
|
||||||
memcpy ((unsigned char *)&hardware -> haddr [0],
|
memcpy ((unsigned char *)&hardware -> haddr [0],
|
||||||
t, hardware -> hlen);
|
t, hardware -> hlen);
|
||||||
|
if (hlen < sizeof hardware -> haddr)
|
||||||
|
memset (&hardware -> haddr [hlen], 0,
|
||||||
|
(sizeof hardware -> haddr) - hlen);
|
||||||
free (t);
|
free (t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user