Imported latest versions from Etherboot 5.4
This commit is contained in:
@@ -357,52 +357,12 @@ static void modify_dhcp_resp(void *buf, __u16 size)
|
||||
modify_udp_csum(buf, size);
|
||||
}
|
||||
|
||||
static void get_my_client_id(__u8 * my_client_id)
|
||||
{
|
||||
|
||||
my_client_id[0] = 0;
|
||||
qpn2buf(ipoib_data.ipoib_qpn, my_client_id + 1);
|
||||
memcpy(my_client_id + 4, ipoib_data.port_gid_raw, 16);
|
||||
}
|
||||
|
||||
static const __u8 *get_client_id(const void *buf, int len)
|
||||
{
|
||||
const __u8 *ptr;
|
||||
int delta;
|
||||
|
||||
if (len < 268)
|
||||
return NULL;
|
||||
|
||||
/* pointer to just after magic cookie */
|
||||
ptr = (const __u8 *)buf + 268;
|
||||
|
||||
/* find last client identifier option */
|
||||
do {
|
||||
if (ptr[0] == 255) {
|
||||
/* found end of options list */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (ptr[0] == 0x3d) {
|
||||
/* client identifer option */
|
||||
return ptr + 3;
|
||||
}
|
||||
|
||||
delta = ptr[1] + 2;
|
||||
ptr += delta;
|
||||
len -= delta;
|
||||
} while (len > 0);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int handle_ipv4_packet(void *buf, void **out_buf_p,
|
||||
unsigned int *new_size_p, int *is_bcast_p)
|
||||
{
|
||||
void *new_buf;
|
||||
__u16 new_size;
|
||||
__u8 msg_type;
|
||||
__u8 my_client_id[20];
|
||||
|
||||
new_buf = (void *)(((__u8 *) buf) + 4);
|
||||
new_size = (*new_size_p) - 4;
|
||||
@@ -411,7 +371,6 @@ static int handle_ipv4_packet(void *buf, void **out_buf_p,
|
||||
|
||||
if (get_ip_protocl(new_buf) == IP_PROT_UDP) {
|
||||
__u16 udp_dst_port;
|
||||
const __u8 *client_id;
|
||||
|
||||
udp_dst_port = get_udp_dst_port(new_buf);
|
||||
|
||||
@@ -420,22 +379,6 @@ static int handle_ipv4_packet(void *buf, void **out_buf_p,
|
||||
*out_buf_p = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (udp_dst_port == 68) {
|
||||
get_my_client_id(my_client_id);
|
||||
|
||||
/* packet client id */
|
||||
client_id = get_client_id(new_buf, new_size);
|
||||
if (!client_id) {
|
||||
*out_buf_p = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (memcmp(client_id, my_client_id, 20)) {
|
||||
*out_buf_p = 0;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
msg_type = get_dhcp_msg_type(new_buf);
|
||||
@@ -515,8 +458,9 @@ static int ipoib_handle_rcv(void *buf, void **out_buf_p,
|
||||
rc = handle_ipv4_packet(buf, out_buf_p, new_size_p, is_bcast_p);
|
||||
return rc;
|
||||
}
|
||||
eprintf("prot=0x%x", prot_type);
|
||||
return -1;
|
||||
tprintf("prot=0x%x", prot_type);
|
||||
*out_buf_p = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int is_null_mac(const __u8 * mac)
|
||||
|
||||
Reference in New Issue
Block a user