about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2008-03-08 19:17:22 +0000
committerUlrich Drepper <drepper@redhat.com>2008-03-08 19:17:22 +0000
commit725c0c87926abdc5f7b2fee52132d9ec82d64ac3 (patch)
tree8f21c7cb795ac60ebbad25a4d783c3f72a401994
parent368a8dec0ae2209be167daea8034646abcba220d (diff)
downloadglibc-725c0c87926abdc5f7b2fee52132d9ec82d64ac3.tar.gz
glibc-725c0c87926abdc5f7b2fee52132d9ec82d64ac3.tar.xz
glibc-725c0c87926abdc5f7b2fee52132d9ec82d64ac3.zip
[BZ #5760]
	* inet/inet6_opt.c (inet6_opt_init): Fix ip6h_len computation.
	Patch by Roland Bless <roland@bless.de>.
-rw-r--r--ChangeLog4
-rw-r--r--inet/inet6_opt.c8
2 files changed, 10 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index a6a47faf4e..951cf3576f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2008-03-08  Ulrich Drepper  <drepper@redhat.com>
 
+	[BZ #5760]
+	* inet/inet6_opt.c (inet6_opt_init): Fix ip6h_len computation.
+	Patch by Roland Bless <roland@bless.de>.
+
 	* sysdeps/unix/sysv/linux/dl-sysdep.c: Avoid unnecessary code for
 	.o file.
 	* elf/Makefile (routines): Add dl-sysdep.
diff --git a/inet/inet6_opt.c b/inet/inet6_opt.c
index 17d3fee213..83063d2259 100644
--- a/inet/inet6_opt.c
+++ b/inet/inet6_opt.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2006.
 
@@ -39,7 +39,11 @@ inet6_opt_init (void *extbuf, socklen_t extlen)
 
       /* Fill in the length in units of 8 octets.  */
       struct ip6_hbh *extp = (struct ip6_hbh *) extbuf;
-      extp->ip6h_len = extlen / 8;
+
+      /* RFC 2460 requires that the header extension length is the
+	 length of the option header in 8-byte units, not including
+	 the first 8 bytes.  Hence we have to subtract one.  */
+      extp->ip6h_len = extlen / 8 - 1;
     }
 
   return sizeof (struct ip6_hbh);