grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
From: Josef Bacik <jbacik@fb.com>
To: <grub-devel@gnu.org>, <mchang@suse.com>, <pjones@redhat.com>
Subject: [PATCH 2/3] net: add local route when creating link local ipv6 interface
Date: Wed, 5 Aug 2015 14:36:38 -0400	[thread overview]
Message-ID: <1438799799-32097-2-git-send-email-jbacik@fb.com> (raw)
In-Reply-To: <1438799799-32097-1-git-send-email-jbacik@fb.com>

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 <jbacik@fb.com>
---
 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



  reply	other threads:[~2015-08-05 18:36 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-05 18:36 [PATCH 1/3] efinet: handle get_status() properly Josef Bacik
2015-08-05 18:36 ` Josef Bacik [this message]
2015-08-07  8:38   ` [PATCH 2/3] net: add local route when creating link local ipv6 interface Andrei Borzenkov
2015-08-05 18:36 ` [PATCH 3/3] net: fix ipv6 routing Josef Bacik
2015-08-09 14:58   ` Andrei Borzenkov
2015-08-10 14:00     ` Josef Bacik
2015-08-10 14:07       ` Andrei Borzenkov
2015-08-05 20:04 ` [PATCH 1/3] efinet: handle get_status() properly Andrei Borzenkov
2015-08-05 20:26   ` Josef Bacik
2015-08-05 20:32     ` Vladimir 'phcoder' Serbinenko
2015-08-05 20:39       ` Josef Bacik
2015-08-05 20:50         ` Josef Bacik
2015-08-05 20:52           ` Vladimir 'phcoder' Serbinenko
2015-08-06  3:42       ` Andrei Borzenkov
2015-08-06 14:26         ` Josef Bacik
2015-08-05 20:57     ` Seth Goldberg
2015-08-06 17:49 ` [PATCH V2] efinet: handle get_status() on buggy firmware properly Josef Bacik
2015-08-09 13:48   ` Andrei Borzenkov
  -- strict thread matches above, loose matches on Subject: below --
2015-08-05 17:50 [PATCH 0/3] fix ipv6 support Josef Bacik
2015-08-05 17:50 ` [PATCH 2/3] net: add local route when creating link local ipv6 interface Josef Bacik

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=1438799799-32097-2-git-send-email-jbacik@fb.com \
    --to=jbacik@fb.com \
    --cc=grub-devel@gnu.org \
    --cc=mchang@suse.com \
    --cc=pjones@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).