grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCHv3] EFI - PXE - include details from proxy (altserviceboot) offer


From: Mroczek, Joseph T
Subject: [PATCHv3] EFI - PXE - include details from proxy (altserviceboot) offer when available - Bug 41488
Date: Fri, 14 Feb 2014 02:04:36 +0000

Hello:

Here is an updated patch. The patch now combines data from both packets into a 
single source before sending to configure_by_dhcp_ack.

This patch resolved the issues with not configuring, however it seems to have 
unconvered another issue, where grub uses wrong mac address when attempting to 
communicate with tftp server.

As always, please let me know what I can do to help get this issue resolved.

~joe


diff -Naur grub-2.02~beta2/grub-core/net/bootp.c 
grub-2.02~beta2-bug41488-jtm2/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-bug41488-jtm2/grub-core/net/bootp.c 2014-02-13 
17:57:57.402895600 -0500
@@ -161,6 +161,50 @@
 
 #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)
+{
+  grub_uint8_t i;
+
+  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);
+  for (i = 0 ; i > 64 ; ++i)
+   if (source->server_name[i])
+     {
+       grub_memcpy (&target->server_name, &source->server_name, 64);
+       break;
+     }
+  for (i = 0 ; i > 128 ; ++i)
+   if (source->boot_file[i])
+     {
+       grub_memcpy (&target->boot_file, &source->boot_file, 128);
+       break;
+     }
+}
+
+
 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/grub-core/net/drivers/efi/efinet.c 
grub-2.02~beta2-bug41488-jtm2/grub-core/net/drivers/efi/efinet.c
--- grub-2.02~beta2/grub-core/net/drivers/efi/efinet.c  2013-12-24 
11:29:27.000000000 -0500
+++ grub-2.02~beta2-bug41488-jtm2/grub-core/net/drivers/efi/efinet.c    
2014-02-13 18:06:05.718895600 -0500
@@ -223,6 +223,7 @@
 {
   struct grub_net_card *card;
   grub_efi_device_path_t *dp;
+  struct grub_net_bootp_packet *combined_bootp = NULL;
 
   dp = grub_efi_get_device_path (hnd);
   if (! dp)
@@ -245,11 +246,22 @@
     if (! pxe)
       continue;
     pxe_mode = pxe->mode;
-    grub_net_configure_by_dhcp_ack (card->name, card, 0,
-                                   (struct grub_net_bootp_packet *)
-                                   &pxe_mode->dhcp_ack,
-                                   sizeof (pxe_mode->dhcp_ack),
-                                   1, device, path);
+    if (pxe_mode->proxy_offer_received)
+      {
+        combined_bootp = grub_zalloc (sizeof (*combined_bootp));
+        grub_net_merge_dhcp_ack (combined_bootp, (struct grub_net_bootp_packet 
*) pxe_mode->proxy_offer);
+        grub_net_merge_dhcp_ack (combined_bootp, (struct grub_net_bootp_packet 
*) pxe_mode->dhcp_ack);
+        grub_net_configure_by_dhcp_ack (card->name, card, 0,
+                                        combined_bootp,
+                                                                               
 sizeof (combined_bootp),
+                                                                               
 1, device, path);
+      }
+    else
+      grub_net_configure_by_dhcp_ack (card->name, card, 0,
+                                                                          
(struct grub_net_bootp_packet *)
+                                                                          
&pxe_mode->dhcp_ack,
+                                                                          
sizeof (pxe_mode->dhcp_ack),
+                                                                          1, 
device, path);
     return;
   }
 }
diff -Naur grub-2.02~beta2/include/grub/efi/api.h 
grub-2.02~beta2-bug41488-jtm2/include/grub/efi/api.h
--- grub-2.02~beta2/include/grub/efi/api.h      2013-12-24 12:04:54.000000000 
-0500
+++ grub-2.02~beta2-bug41488-jtm2/include/grub/efi/api.h        2014-02-13 
12:31:00.026895600 -0500
@@ -526,7 +526,7 @@
 typedef grub_uint8_t grub_efi_mac_address_t[32];
 typedef grub_uint8_t grub_efi_ipv4_address_t[4];
 typedef grub_uint16_t grub_efi_ipv6_address_t[8];
-typedef grub_uint8_t grub_efi_ip_address_t[8] __attribute__ ((aligned(4)));
+typedef grub_uint8_t grub_efi_ip_address_t[16] __attribute__ ((aligned(4)));
 typedef grub_efi_uint64_t grub_efi_physical_address_t;
 typedef grub_efi_uint64_t grub_efi_virtual_address_t;
 
@@ -1342,12 +1342,33 @@
 
 typedef struct grub_efi_pxe_mode
 {
-  grub_uint8_t unused[52];
+  grub_uint8_t started;
+  grub_uint8_t ipv6_available;
+  grub_uint8_t ipv6_supported;
+  grub_uint8_t using_ipv6;
+  grub_uint8_t bis_supported;
+  grub_uint8_t bis_detected;
+  grub_uint8_t auto_arp;
+  grub_uint8_t send_guid;
+  grub_uint8_t dhcp_discover_valid;
+  grub_uint8_t dhcp_ack_received;
+  grub_uint8_t proxy_offer_received;
+  grub_uint8_t pxe_discover_valid;
+  grub_uint8_t pxe_reply_received;
+  grub_uint8_t pxe_bis_reply_received;
+  grub_uint8_t icmp_error_received;
+  grub_uint8_t tftp_error_received;
+  grub_uint8_t make_callbacks;
+  grub_uint8_t ttl;
+  grub_uint8_t tos;
+  grub_efi_ip_address_t station_ip;
+  grub_efi_ip_address_t subnet_mask;
   grub_efi_pxe_packet_t dhcp_discover;
   grub_efi_pxe_packet_t dhcp_ack;
   grub_efi_pxe_packet_t proxy_offer;
   grub_efi_pxe_packet_t pxe_discover;
   grub_efi_pxe_packet_t pxe_reply;
+  grub_efi_pxe_packet_t pxe_bis_reply;
 } grub_efi_pxe_mode_t;
 
 typedef struct grub_efi_pxe
diff -Naur grub-2.02~beta2/include/grub/net.h 
grub-2.02~beta2-bug41488-jtm2/include/grub/net.h
--- grub-2.02~beta2/include/grub/net.h  2013-12-24 11:40:31.000000000 -0500
+++ grub-2.02~beta2-bug41488-jtm2/include/grub/net.h    2014-02-13 
17:54:05.774895600 -0500
@@ -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,



reply via email to

[Prev in Thread] Current Thread [Next in Thread]