net: fix ipv6 routing
ipv6 routing in grub2 is broken, we cannot talk to anything outside our local network or anything that doesn't route in our global namespace. This patch fixes this by doing a couple of things 1) Read the router information off of the router advertisement. If we have a router lifetime we need to take the source address and create a route from it. 2) Changes the routing stuff slightly to allow you to specify a gateway _and_ an interface. Since the router advertisements come in on the link local address we need to associate it with the global address on the card. So when we are processing the router advertisement, either use the SLAAC interface we create and add the route to that interface, or loop through the global addresses we currently have on our interface and associate it with one of those addresses. We need to have a special case here for the default route so that it gets used, we do this by setting the masksize to 0 to mean it encompasses all networks. The routing code will automatically select the best route so if there is a closer match we will use that. With this patch I can now talk to ipv6 addresses outside of my local network. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com>
This commit is contained in:
parent
94c56a4c65
commit
eb9f401fc1
5 changed files with 103 additions and 31 deletions
|
@ -151,7 +151,7 @@ grub_ieee1275_parse_bootpath (const char *devpath, char *bootpath,
|
|||
grub_net_network_level_address_t client_addr, gateway_addr, subnet_mask;
|
||||
grub_net_link_level_address_t hw_addr;
|
||||
grub_net_interface_flags_t flags = 0;
|
||||
struct grub_net_network_level_interface *inter;
|
||||
struct grub_net_network_level_interface *inter = NULL;
|
||||
|
||||
hw_addr.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET;
|
||||
|
||||
|
@ -221,7 +221,7 @@ grub_ieee1275_parse_bootpath (const char *devpath, char *bootpath,
|
|||
target.ipv4.masksize = 0;
|
||||
rname = grub_xasprintf ("%s:default", ((*card)->name));
|
||||
if (rname)
|
||||
grub_net_add_route_gw (rname, target, gateway_addr);
|
||||
grub_net_add_route_gw (rname, target, gateway_addr, inter);
|
||||
else
|
||||
return grub_errno;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue