]> Git Repo - J-u-boot.git/commitdiff
efi_loader: add IPv4() to device path to text protocol
authorHeinrich Schuchardt <[email protected]>
Wed, 4 Dec 2024 03:05:19 +0000 (00:05 -0300)
committerHeinrich Schuchardt <[email protected]>
Wed, 4 Dec 2024 11:24:37 +0000 (12:24 +0100)
Implement Ipv4() node support in the device path to text protocol.

Signed-off-by: Adriano Cordova <[email protected]>
Reviewed-by: Ilias Apalodimas <[email protected]>
Signed-off-by: Heinrich Schuchardt <[email protected]>
lib/efi_loader/efi_device_path_to_text.c

index 0c7b30a26e7e71e1ae3788018dfdfd930a0ece3f..481a9712d9d728c69f7c8605ec321ea5414524c5 100644 (file)
@@ -8,6 +8,7 @@
 #include <blk.h>
 #include <efi_loader.h>
 #include <malloc.h>
+#include <net.h>
 
 #define MAC_OUTPUT_LEN 22
 #define UNKNOWN_OUTPUT_LEN 23
@@ -170,6 +171,28 @@ static char *dp_msging(char *s, struct efi_device_path *dp)
 
                break;
        }
+       case DEVICE_PATH_SUB_TYPE_MSG_IPV4: {
+               struct efi_device_path_ipv4 *idp =
+                       (struct efi_device_path_ipv4 *)dp;
+
+               s += sprintf(s, "IPv4(%pI4,", &idp->remote_ip_address);
+               switch (idp->protocol) {
+               case IPPROTO_TCP:
+                       s += sprintf(s, "TCP,");
+               case IPPROTO_UDP:
+                       s += sprintf(s, "UDP,");
+               default:
+                       s += sprintf(s, "0x%x,", idp->protocol);
+               }
+               s += sprintf(s, idp->static_ip_address ? "Static" : "DHCP");
+               s += sprintf(s, ",%pI4", &idp->local_ip_address);
+               if (idp->dp.length == sizeof(struct efi_device_path_ipv4))
+                       s += sprintf(s, ",%pI4,%pI4", &idp->gateway_ip_address,
+                                    &idp->subnet_mask);
+               s += sprintf(s, ")");
+
+               break;
+       }
        case DEVICE_PATH_SUB_TYPE_MSG_USB_CLASS: {
                struct efi_device_path_usb_class *ucdp =
                        (struct efi_device_path_usb_class *)dp;
This page took 0.036047 seconds and 4 git commands to generate.