mirror of
https://gitlab.isc.org/isc-projects/dhcp
synced 2025-08-31 22:35:25 +00:00
Move packet location code out of dispatch
This commit is contained in:
14
bootp.c
14
bootp.c
@@ -51,9 +51,7 @@ void bootp (packet)
|
|||||||
struct packet *packet;
|
struct packet *packet;
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
struct host_decl *hp = find_hosts_by_haddr (packet -> raw -> htype,
|
struct host_decl *hp;
|
||||||
packet -> raw -> chaddr,
|
|
||||||
packet -> raw -> hlen);
|
|
||||||
struct host_decl *host = (struct host_decl *)0;
|
struct host_decl *host = (struct host_decl *)0;
|
||||||
struct packet outgoing;
|
struct packet outgoing;
|
||||||
struct dhcp_packet raw;
|
struct dhcp_packet raw;
|
||||||
@@ -69,6 +67,13 @@ void bootp (packet)
|
|||||||
packet -> raw -> hlen,
|
packet -> raw -> hlen,
|
||||||
packet -> raw -> chaddr));
|
packet -> raw -> chaddr));
|
||||||
|
|
||||||
|
if (!locate_network (packet))
|
||||||
|
return;
|
||||||
|
|
||||||
|
hp = find_hosts_by_haddr (packet -> raw -> htype,
|
||||||
|
packet -> raw -> chaddr,
|
||||||
|
packet -> raw -> hlen);
|
||||||
|
|
||||||
lease = find_lease (packet);
|
lease = find_lease (packet);
|
||||||
|
|
||||||
/* Find an IP address in the host_decl that matches the
|
/* Find an IP address in the host_decl that matches the
|
||||||
@@ -224,7 +229,8 @@ void bootp (packet)
|
|||||||
|
|
||||||
#ifdef USE_FALLBACK
|
#ifdef USE_FALLBACK
|
||||||
result = send_fallback (&fallback_interface,
|
result = send_fallback (&fallback_interface,
|
||||||
packet, &raw, outgoing.packet_length,
|
(struct packet *)0,
|
||||||
|
&raw, outgoing.packet_length,
|
||||||
raw.siaddr, &to, &hto);
|
raw.siaddr, &to, &hto);
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
warn ("send_fallback: %m");
|
warn ("send_fallback: %m");
|
||||||
|
3
dhcp.c
3
dhcp.c
@@ -52,6 +52,9 @@ static unsigned char dhcp_message [256];
|
|||||||
void dhcp (packet)
|
void dhcp (packet)
|
||||||
struct packet *packet;
|
struct packet *packet;
|
||||||
{
|
{
|
||||||
|
if (!locate_network (packet))
|
||||||
|
return;
|
||||||
|
|
||||||
switch (packet -> packet_type) {
|
switch (packet -> packet_type) {
|
||||||
case DHCPDISCOVER:
|
case DHCPDISCOVER:
|
||||||
dhcpdiscover (packet);
|
dhcpdiscover (packet);
|
||||||
|
@@ -51,9 +51,7 @@ void bootp (packet)
|
|||||||
struct packet *packet;
|
struct packet *packet;
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
struct host_decl *hp = find_hosts_by_haddr (packet -> raw -> htype,
|
struct host_decl *hp;
|
||||||
packet -> raw -> chaddr,
|
|
||||||
packet -> raw -> hlen);
|
|
||||||
struct host_decl *host = (struct host_decl *)0;
|
struct host_decl *host = (struct host_decl *)0;
|
||||||
struct packet outgoing;
|
struct packet outgoing;
|
||||||
struct dhcp_packet raw;
|
struct dhcp_packet raw;
|
||||||
@@ -69,6 +67,13 @@ void bootp (packet)
|
|||||||
packet -> raw -> hlen,
|
packet -> raw -> hlen,
|
||||||
packet -> raw -> chaddr));
|
packet -> raw -> chaddr));
|
||||||
|
|
||||||
|
if (!locate_network (packet))
|
||||||
|
return;
|
||||||
|
|
||||||
|
hp = find_hosts_by_haddr (packet -> raw -> htype,
|
||||||
|
packet -> raw -> chaddr,
|
||||||
|
packet -> raw -> hlen);
|
||||||
|
|
||||||
lease = find_lease (packet);
|
lease = find_lease (packet);
|
||||||
|
|
||||||
/* Find an IP address in the host_decl that matches the
|
/* Find an IP address in the host_decl that matches the
|
||||||
@@ -224,7 +229,8 @@ void bootp (packet)
|
|||||||
|
|
||||||
#ifdef USE_FALLBACK
|
#ifdef USE_FALLBACK
|
||||||
result = send_fallback (&fallback_interface,
|
result = send_fallback (&fallback_interface,
|
||||||
packet, &raw, outgoing.packet_length,
|
(struct packet *)0,
|
||||||
|
&raw, outgoing.packet_length,
|
||||||
raw.siaddr, &to, &hto);
|
raw.siaddr, &to, &hto);
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
warn ("send_fallback: %m");
|
warn ("send_fallback: %m");
|
||||||
|
@@ -52,6 +52,9 @@ static unsigned char dhcp_message [256];
|
|||||||
void dhcp (packet)
|
void dhcp (packet)
|
||||||
struct packet *packet;
|
struct packet *packet;
|
||||||
{
|
{
|
||||||
|
if (!locate_network (packet))
|
||||||
|
return;
|
||||||
|
|
||||||
switch (packet -> packet_type) {
|
switch (packet -> packet_type) {
|
||||||
case DHCPDISCOVER:
|
case DHCPDISCOVER:
|
||||||
dhcpdiscover (packet);
|
dhcpdiscover (packet);
|
||||||
|
Reference in New Issue
Block a user