[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/3] Added net_bootp6 command
From: |
Michael Chang |
Subject: |
Re: [PATCH 1/3] Added net_bootp6 command |
Date: |
Fri, 15 May 2015 21:57:28 +0800 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Fri, May 15, 2015 at 09:26:06AM +0300, Andrei Borzenkov wrote:
> В Tue, 12 May 2015 16:49:48 +0800
> Michael Chang <address@hidden> пишет:
>
> > The net_bootp6 is used to configure the ipv6 network interface through the
> > DHCPv6 protocol Solict/Advertise/Request/Reply.
> > ---
> > grub-core/net/bootp.c | 895
> > ++++++++++++++++++++++++++++++++++++++++++++++++-
> > grub-core/net/ip.c | 35 ++
> > include/grub/net.h | 19 +
> > 3 files changed, 948 insertions(+), 1 deletions(-)
> >
> > diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c
> > index 6136755..5c5eb6f 100644
> > --- a/grub-core/net/bootp.c
> > +++ b/grub-core/net/bootp.c
> > @@ -24,6 +24,8 @@
> > #include <grub/net/netbuff.h>
> > #include <grub/net/udp.h>
> > #include <grub/datetime.h>
> > +#include <grub/time.h>
> > +#include <grub/list.h>
> >
> > static void
> > parse_dhcp_vendor (const char *name, const void *vend, int limit, int
> > *mask)
> > @@ -256,6 +258,646 @@ grub_net_configure_by_dhcp_ack (const char *name,
> > return inter;
> > }
> >
> > +struct grub_dhcpv6_option {
> > + grub_uint16_t code;
> > + grub_uint16_t len;
>
> Won't do; options in packet are unaligned (see below) so you have to
> walk byte buffer using get_unaligned and
I don't get it. Wouldn't the structure attribute GRUB_PACKED do the
trick for us?
>
> grub_uint8_t code[2]
> grub_uint8_t len[2]
>
> > + grub_uint8_t data[0];
> > +} GRUB_PACKED;
> > +
> > +
> > +struct grub_dhcpv6_iana_option {
> > + grub_uint32_t iaid;
> > + grub_uint32_t t1;
> > + grub_uint32_t t2;
> > + grub_uint8_t data[0];
> > +} GRUB_PACKED;
> > +
> > +struct grub_dhcpv6_iaaddr_option {
> > + grub_uint8_t addr[16];
> > + grub_uint32_t preferred_lifetime;
> > + grub_uint32_t valid_lifetime;
> > + grub_uint8_t data[0];
> > +} GRUB_PACKED;
> > +
> > +struct grub_DUID_LL
> > +{
> > + grub_uint16_t type;
> > + grub_uint16_t hw_type;
> > + grub_uint8_t hwaddr[6];
> > +} GRUB_PACKED;
> > +
>
> Probably the same applies to all option definitions.
That would require quite a lot of rewritting basically. (So I'd like it
to be clear to me in the first).
Thanks,
Michael
Re: [PATCH v1] Support DHCPv6 and UEFI IPv6 PXE, Andrei Borzenkov, 2015/05/15