mirror of
https://gitlab.isc.org/isc-projects/dhcp
synced 2025-09-02 15:25:48 +00:00
Take dhcp packet as an argument instead of converting. Limit length of hardware address.
This commit is contained in:
@@ -42,7 +42,7 @@
|
|||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char copyright[] =
|
static char copyright[] =
|
||||||
"$Id: dhcrelay.c,v 1.12 1998/03/16 06:16:54 mellon Exp $ Copyright (c) 1997 The Internet Software Consortium. All rights reserved.\n";
|
"$Id: dhcrelay.c,v 1.13 1998/06/25 03:39:04 mellon Exp $ Copyright (c) 1997 The Internet Software Consortium. All rights reserved.\n";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include "dhcpd.h"
|
#include "dhcpd.h"
|
||||||
@@ -227,18 +227,22 @@ int main (argc, argv, envp)
|
|||||||
|
|
||||||
void relay (ip, packbuf, length, from_port, from, hfrom)
|
void relay (ip, packbuf, length, from_port, from, hfrom)
|
||||||
struct interface_info *ip;
|
struct interface_info *ip;
|
||||||
u_int8_t *packbuf;
|
struct dhcp_packet *packet;
|
||||||
int length;
|
int length;
|
||||||
unsigned int from_port;
|
unsigned int from_port;
|
||||||
struct iaddr from;
|
struct iaddr from;
|
||||||
struct hardware *hfrom;
|
struct hardware *hfrom;
|
||||||
{
|
{
|
||||||
struct dhcp_packet *packet = (struct dhcp_packet *)packbuf;
|
|
||||||
struct server_list *sp;
|
struct server_list *sp;
|
||||||
struct sockaddr_in to;
|
struct sockaddr_in to;
|
||||||
struct interface_info *out;
|
struct interface_info *out;
|
||||||
struct hardware hto;
|
struct hardware hto;
|
||||||
|
|
||||||
|
if (packet -> hlen > sizeof packet -> chaddr) {
|
||||||
|
note ("Discarding packet with invalid hlen.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* If it's a bootreply, forward it to the client. */
|
/* If it's a bootreply, forward it to the client. */
|
||||||
if (packet -> op == BOOTREPLY) {
|
if (packet -> op == BOOTREPLY) {
|
||||||
#ifndef USE_FALLBACK
|
#ifndef USE_FALLBACK
|
||||||
|
Reference in New Issue
Block a user