[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/3] net: add local route when creating link local ipv6 interface
From: |
Josef Bacik |
Subject: |
[PATCH 2/3] net: add local route when creating link local ipv6 interface |
Date: |
Wed, 5 Aug 2015 14:36:38 -0400 |
In order to talk to link local ipv6 addresses we need to have a route out of the
link local interface for this to work. Thanks,
Signed-off-by: Josef Bacik <address@hidden>
---
grub-core/net/net.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/grub-core/net/net.c b/grub-core/net/net.c
index 21a4e94..f96297a 100644
--- a/grub-core/net/net.c
+++ b/grub-core/net/net.c
@@ -297,7 +297,9 @@ grub_net_ipv6_get_link_local (struct grub_net_card *card,
struct grub_net_network_level_interface *inf;
char *name;
char *ptr;
+ grub_err_t err;
grub_net_network_level_address_t addr;
+ grub_net_network_level_netaddress_t netaddr;
name = grub_malloc (grub_strlen (card->name)
+ GRUB_NET_MAX_STR_HWADDR_LEN
@@ -325,7 +327,17 @@ grub_net_ipv6_get_link_local (struct grub_net_card *card,
ptr += grub_strlen (ptr);
}
ptr = grub_stpcpy (ptr, ":link");
- return grub_net_add_addr_real (name, card, &addr, hwaddr, 0);
+ inf = grub_net_add_addr_real (name, card, &addr, hwaddr, 0);
+ if (!inf)
+ return NULL;
+ netaddr.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6;
+ netaddr.ipv6.base[0] = grub_cpu_to_be64_compile_time (0xfe80ULL << 48);
+ netaddr.ipv6.base[1] = 0;
+ netaddr.ipv6.masksize = 64;
+ err = grub_net_add_route (name, netaddr, inf);
+ if (err != GRUB_ERR_NONE)
+ return NULL;
+ return inf;
}
/* FIXME: allow to specify mac address. */
--
2.1.0