[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 12/14] icmp6: use default interface as the route interface
From: |
Josef Bacik |
Subject: |
[PATCH 12/14] icmp6: use default interface as the route interface |
Date: |
Wed, 10 Feb 2016 13:21:06 -0800 |
As it stands now if we do dhcp and slaac we'll use the slaac interface for any
routes advertised on the local network as those will be the first interfaces we
find. However if we have a default interface, ie the one set up from the pxe
dhcp packet, we would prefer to use this one. So when getting RA's, check to
see if our default interface is a v6 interface and matches the card we got the
RA on, and if so use that as the route interface. This allows us to get traffic
from the dhcp interface instead of through the slaac interface.
Signed-off-by: Josef Bacik <address@hidden>
---
grub-core/net/icmp6.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/grub-core/net/icmp6.c b/grub-core/net/icmp6.c
index 2cbd95d..f02e9cd 100644
--- a/grub-core/net/icmp6.c
+++ b/grub-core/net/icmp6.c
@@ -19,6 +19,7 @@
#include <grub/net.h>
#include <grub/net/ip.h>
#include <grub/net/netbuff.h>
+#include <grub/env.h>
struct icmp_header
{
@@ -361,6 +362,7 @@ grub_net_recv_icmp6_packet (struct grub_net_buff *nb,
if (grub_be_to_cpu16 (radv->router_lifetime) > 0)
{
struct grub_net_route *route;
+ const char *default_inf = grub_env_get ("net_default_interface");
FOR_NET_ROUTES (route)
{
@@ -369,6 +371,24 @@ grub_net_recv_icmp6_packet (struct grub_net_buff *nb,
}
if (route == NULL)
default_route = 1;
+
+ /* If we have a default interface and it's on the same card as we're
+ getting this advertisement on then we want to make sure we use
+ that interface as the route interface. */
+ if (default_inf)
+ {
+ FOR_NET_NETWORK_LEVEL_INTERFACES (inf)
+ {
+ if (grub_strcmp(default_inf, inf->name))
+ continue;
+ if (inf->card == card && inf != orig_inf
+ && inf->address.type ==
GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6
+ && grub_net_hwaddr_cmp(&inf->hwaddress,
+ &orig_inf->hwaddress) == 0)
+ route_inf = inf;
+ break;
+ }
+ }
}
for (ptr = (grub_uint8_t *) nb->data; ptr < nb->tail;
--
1.8.1
- [PATCH 09/14] efinet: clear the txbuffer before modifying the receive filters, (continued)
- [PATCH 12/14] icmp6: use default interface as the route interface,
Josef Bacik <=
- [PATCH 04/14] tcp: add window scaling and RTTM support, Josef Bacik, 2016/02/10
- [PATCH 01/14] Added net_bootp6 command, Josef Bacik, 2016/02/10
- [PATCH 02/14] UEFI IPv6 PXE support, Josef Bacik, 2016/02/10
- [PATCH 05/14] net: don't free uninitialized sockets in dns, Josef Bacik, 2016/02/10
- [PATCH 07/14] efinet: retransmit if our device is busy, Josef Bacik, 2016/02/10
- [PATCH 03/14] Use UEFI MAC device as default configured by net_bootp6, Josef Bacik, 2016/02/10
- [PATCH 14/14] net: add interfaces when we open a card, Josef Bacik, 2016/02/10
- [PATCH 06/14] net: fix ipv6 routing, Josef Bacik, 2016/02/10