From: Matthew Iselin <matt...@theiselins.net>

Signed-off-by: Matthew Iselin <matt...@theiselins.net>
---
 src/net/ndp.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/net/ndp.c b/src/net/ndp.c
index 5205554..be1fa94 100644
--- a/src/net/ndp.c
+++ b/src/net/ndp.c
@@ -177,8 +177,8 @@ int ndp_process_radvert ( struct io_buffer *iobuf, struct 
sockaddr_tcpip *st_src
                        prefix_len = opt->prefix_len;
 
                        if ( prefix_len % 8 ) {
-                               /* FIXME: non-aligned prefixes unhandled */
-                               DBG ( "ndp: prefix length is unaligned, 
connectivity may suffer.\n" );
+                               /* Copy one extra prefix byte. */
+                               prefix_len += 8;
                        }
 
                        if ( prefix_len > 64 ) {
@@ -186,6 +186,9 @@ int ndp_process_radvert ( struct io_buffer *iobuf, struct 
sockaddr_tcpip *st_src
                                DBG ( "ndp: prefix length is quite long, 
connectivity may suffer.\n" );
                        }
 
+                       /* Copy the prefix first and then add the EUI-64 */
+                       memcpy( &host_addr.s6_addr, opt->prefix, prefix_len / 8 
);
+
                        /* Create an IPv6 address for this station based on the 
prefix. */
                        ll_size = netdev->ll_protocol->ll_addr_len;
                        if ( ll_size < 6 ) {
@@ -194,8 +197,6 @@ int ndp_process_radvert ( struct io_buffer *iobuf, struct 
sockaddr_tcpip *st_src
                                ipv6_generate_eui64 ( host_addr.s6_addr + 8, 
netdev->ll_addr );
                        }
 
-                       memcpy( &host_addr.s6_addr, opt->prefix, prefix_len / 8 
);
-
                        rc = 0;
                        }
                        break;
-- 
1.7.2.5

_______________________________________________
gPXE-devel mailing list
gPXE-devel@etherboot.org
http://etherboot.org/mailman/listinfo/gpxe-devel

Reply via email to