|
From: | Mroczek, Joseph T |
Subject: | RFC Patch [1/2] PXE Add support for proxy DHCP -- Common Code |
Date: | Sat, 19 Apr 2014 00:26:42 +0000 |
Hello: This patch adds support for merging data from 2 different dhcp packets into a single source with precedence based on PXE and uEFI specs. ~joe diff -Naur grub-2.02~beta2/grub-core/net/bootp.c grub-2.02~beta2-jtm-clean/grub-core/net/bootp.c --- grub-2.02~beta2/grub-core/net/bootp.c 2013-12-24 11:40:31.000000000 -0500 +++ grub-2.02~beta2-jtm-clean/grub-core/net/bootp.c 2014-04-18 19:26:44.862208600 -0400 @@ -161,6 +161,42 @@ #define OFFSET_OF(x, y) ((grub_size_t)((grub_uint8_t *)((y)->x) - (grub_uint8_t *)(y))) +void grub_net_merge_dhcp_ack (struct grub_net_bootp_packet *target, + struct grub_net_bootp_packet *source) +{ + if (source->opcode) + target->opcode = source->opcode; + if (source->hw_type) + target->hw_type = source->hw_type; + if (source->hw_len) + target->hw_len = source->hw_len; + if (source->gate_hops) + target->gate_hops = source->gate_hops; + if (source->ident) + target->ident = source->ident; + if (source->seconds) + target->seconds = source->seconds; + if (source->flags) + target->flags = source->flags; + if (source->client_ip) + target->client_ip = source->client_ip; + if (source->your_ip) + target->your_ip = source->your_ip; + if (source->server_ip) + target->server_ip = source->server_ip; + if (source->gateway_ip) + target->gateway_ip = source->gateway_ip; + if (source->mac_addr) + grub_memcpy (&target->mac_addr, &source->mac_addr, 6); + if (source->server_name[0]) + grub_memcpy (&target->server_name, &source->server_name, 64); + if (source->boot_file[0]) + grub_memcpy (&target->boot_file, &source->boot_file, 128); + if (source->vendor[0]) + grub_memcpy (&target->vendor, &source->vendor, 60); +} + + struct grub_net_network_level_interface * grub_net_configure_by_dhcp_ack (const char *name, struct grub_net_card *card, diff -Naur grub-2.02~beta2/include/grub/net.h grub-2.02~beta2-jtm-clean/include/grub/net.h --- grub-2.02~beta2/include/grub/net.h 2013-12-24 11:40:31.000000000 -0500 +++ grub-2.02~beta2-jtm-clean/include/grub/net.h 2014-04-18 19:26:44.866208600 -0400 @@ -415,7 +415,7 @@ grub_net_bootp_mac_addr_t mac_addr; char server_name[64]; char boot_file[128]; - grub_uint8_t vendor[0]; + grub_uint8_t vendor[60]; } GRUB_PACKED; #define GRUB_NET_BOOTP_RFC1048_MAGIC_0 0x63 @@ -436,6 +436,10 @@ GRUB_NET_BOOTP_END = 0xff }; +void +grub_net_merge_dhcp_ack (struct grub_net_bootp_packet *target, + struct grub_net_bootp_packet *source); + struct grub_net_network_level_interface * grub_net_configure_by_dhcp_ack (const char *name, struct grub_net_card *card, |
[Prev in Thread] | Current Thread | [Next in Thread] |