mirror of
https://github.com/reactos/reactos.git
synced 2025-01-01 03:54:02 +00:00
- Use the target hardware address to find the correct DHCP_ADAPTER for the received packet
svn path=/trunk/; revision=41838
This commit is contained in:
parent
2dbd55ac66
commit
4af59e7e33
3 changed files with 29 additions and 1 deletions
|
@ -355,6 +355,23 @@ PDHCP_ADAPTER AdapterFindInfo( struct interface_info *ip ) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PDHCP_ADAPTER AdapterFindByHardwareAddress( u_int8_t haddr[16], u_int8_t hlen ) {
|
||||||
|
PDHCP_ADAPTER Adapter;
|
||||||
|
PLIST_ENTRY ListEntry;
|
||||||
|
|
||||||
|
for(ListEntry = AdapterList.Flink;
|
||||||
|
ListEntry != &AdapterList;
|
||||||
|
ListEntry = ListEntry->Flink) {
|
||||||
|
Adapter = CONTAINING_RECORD( ListEntry, DHCP_ADAPTER, ListEntry );
|
||||||
|
if (Adapter->DhclientInfo.hw_address.hlen == hlen &&
|
||||||
|
!memcmp(Adapter->DhclientInfo.hw_address.haddr,
|
||||||
|
haddr,
|
||||||
|
hlen)) return Adapter;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
PDHCP_ADAPTER AdapterGetFirst() {
|
PDHCP_ADAPTER AdapterGetFirst() {
|
||||||
if( IsListEmpty( &AdapterList ) ) return NULL; else {
|
if( IsListEmpty( &AdapterList ) ) return NULL; else {
|
||||||
return CONTAINING_RECORD
|
return CONTAINING_RECORD
|
||||||
|
|
|
@ -231,6 +231,7 @@ got_one(struct protocol *l)
|
||||||
struct dhcp_packet packet;
|
struct dhcp_packet packet;
|
||||||
} u;
|
} u;
|
||||||
struct interface_info *ip = l->local;
|
struct interface_info *ip = l->local;
|
||||||
|
PDHCP_ADAPTER adapter;
|
||||||
|
|
||||||
if ((result = receive_packet(ip, u.packbuf, sizeof(u), &from,
|
if ((result = receive_packet(ip, u.packbuf, sizeof(u), &from,
|
||||||
&hfrom)) == -1) {
|
&hfrom)) == -1) {
|
||||||
|
@ -257,7 +258,16 @@ got_one(struct protocol *l)
|
||||||
ifrom.len = 4;
|
ifrom.len = 4;
|
||||||
memcpy(ifrom.iabuf, &from.sin_addr, ifrom.len);
|
memcpy(ifrom.iabuf, &from.sin_addr, ifrom.len);
|
||||||
|
|
||||||
(*bootp_packet_handler)(ip, &u.packet, result,
|
|
||||||
|
adapter = AdapterFindByHardwareAddress(u.packet.chaddr,
|
||||||
|
u.packet.hlen);
|
||||||
|
|
||||||
|
if (!adapter) {
|
||||||
|
warning("Discarding packet with a non-matching target physical address\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
(*bootp_packet_handler)(&adapter->DhclientInfo, &u.packet, result,
|
||||||
from.sin_port, ifrom, &hfrom);
|
from.sin_port, ifrom, &hfrom);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,6 +76,7 @@ extern PDHCP_ADAPTER AdapterGetFirst();
|
||||||
extern PDHCP_ADAPTER AdapterGetNext(PDHCP_ADAPTER);
|
extern PDHCP_ADAPTER AdapterGetNext(PDHCP_ADAPTER);
|
||||||
extern PDHCP_ADAPTER AdapterFindIndex( unsigned int AdapterIndex );
|
extern PDHCP_ADAPTER AdapterFindIndex( unsigned int AdapterIndex );
|
||||||
extern PDHCP_ADAPTER AdapterFindInfo( struct interface_info *info );
|
extern PDHCP_ADAPTER AdapterFindInfo( struct interface_info *info );
|
||||||
|
extern PDHCP_ADAPTER AdapterFindByHardwareAddress( u_int8_t haddr[16], u_int8_t hlen );
|
||||||
extern VOID ApiInit();
|
extern VOID ApiInit();
|
||||||
extern VOID ApiLock();
|
extern VOID ApiLock();
|
||||||
extern VOID ApiUnlock();
|
extern VOID ApiUnlock();
|
||||||
|
|
Loading…
Reference in a new issue