From: Andrew Hamilton <adhamilt@gmail.com>
To: grub-devel@gnu.org
Cc: Andrew Hamilton <adhamilt@gmail.com>
Subject: [PATCH v2 2/2] net/net: Delete Routes for Deleted Interfaces
Date: Sat, 31 Aug 2024 22:31:08 -0500 [thread overview]
Message-ID: <20240901033108.144171-3-adhamilt@gmail.com> (raw)
In-Reply-To: <20240901033108.144171-1-adhamilt@gmail.com>
Signed-off-by: Andrew Hamilton <adhamilt@gmail.com>
---
grub-core/net/net.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/grub-core/net/net.c b/grub-core/net/net.c
index 8cad4fb6d..51e0dd312 100644
--- a/grub-core/net/net.c
+++ b/grub-core/net/net.c
@@ -718,6 +718,23 @@ grub_cmd_deladdr (struct grub_command *cmd __attribute__ ((unused)),
return grub_error (GRUB_ERR_IO,
N_("you can't delete this address"));
+ struct grub_net_route *route;
+ struct grub_net_route **prev;
+
+ /* Remove any existing routes using this interface. */
+ for (prev = &grub_net_routes, route = *prev; route;
+ prev = &((*prev)->next), route = *prev)
+ {
+ if (grub_strcmp (route->interface->name, inter->name) == 0)
+ {
+ *prev = route->next;
+ grub_free (route->name);
+ grub_free (route);
+ if (*prev == NULL)
+ break;
+ }
+ }
+
grub_net_network_level_interface_unregister (inter);
grub_free (inter->name);
grub_free (inter);
--
2.39.2
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
next prev parent reply other threads:[~2024-09-01 3:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-01 3:31 [PATCH v2 0/2] Delete Net Routes for Deleted Interfaces Andrew Hamilton
2024-09-01 3:31 ` [PATCH v2 1/2] tests: Add net_test for network commands Andrew Hamilton
2024-09-01 3:31 ` Andrew Hamilton [this message]
2024-10-03 14:04 ` [PATCH v2 0/2] Delete Net Routes for Deleted Interfaces Andrew Hamilton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240901033108.144171-3-adhamilt@gmail.com \
--to=adhamilt@gmail.com \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.