diff options
author | Avik Sil <aviksil@linux.vnet.ibm.com> | 2014-03-11 17:50:32 +0530 |
---|---|---|
committer | Alexey Kardashevskiy <aik@ozlabs.ru> | 2014-03-18 17:06:49 +1100 |
commit | 259f8bcba876a1700fb378944d09d5bc61adea56 (patch) | |
tree | f0b6f2f75ec7999ff1717a379327ee4d83550c46 /clients/net-snk | |
parent | c3d633a04491a959dd021a9199e3199fc3ad8a41 (diff) | |
download | SLOF-259f8bcba876a1700fb378944d09d5bc61adea56.zip SLOF-259f8bcba876a1700fb378944d09d5bc61adea56.tar.gz SLOF-259f8bcba876a1700fb378944d09d5bc61adea56.tar.bz2 |
Workaround to make grub2 assign server ip from dhcp ack packet only
Sometimes the bootp reply message from a dhcp nak packet is passed to bootloader
(grub2) through "bootp-response" property. Grub2 does not verify if it is an
ack or nak packet and goes on picking up the server ip address from the message.
This makes grub2 unable to make further communication. The workaround here is
made to avoid this situation by copying the bootp reply message only when it is
from dhcp ack packet.
Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Diffstat (limited to 'clients/net-snk')
-rw-r--r-- | clients/net-snk/app/netlib/dhcp.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/clients/net-snk/app/netlib/dhcp.c b/clients/net-snk/app/netlib/dhcp.c index 22bf1f6..a912c2d 100644 --- a/clients/net-snk/app/netlib/dhcp.c +++ b/clients/net-snk/app/netlib/dhcp.c @@ -737,13 +737,6 @@ handle_dhcp(uint8_t * packet, int32_t packetsize) { if (btph -> op != 2) return -1; // it is not Boot Reply - if(response_buffer) { - if(packetsize <= 1720) - memcpy(response_buffer, packet, packetsize); - else - memcpy(response_buffer, packet, 1720); - } - if (memcmp(btph -> vend, dhcp_magic, 4)) { // It is BootP - RFC 951 dhcp_own_ip = htonl(btph -> yiaddr); @@ -906,6 +899,13 @@ handle_dhcp(uint8_t * packet, int32_t packetsize) { // to be able to answer for foreign requests set_ipv4_address(dhcp_own_ip); + if(response_buffer) { + if(packetsize <= 1720) + memcpy(response_buffer, packet, packetsize); + else + memcpy(response_buffer, packet, 1720); + } + /* Subnet mask */ if (opt.flag[DHCP_MASK]) { /* Router */ |