changeset 4281:0173b37a051b draft

dhcp6: fix a memory issue with prior patch Don't allocate memory for T1 or T2 timers when requesting IA_TA addresses.
author Roy Marples <roy@marples.name>
date Tue, 08 May 2018 12:39:26 +0100
parents 16dd1b6b5e13
children 18aa55c59279
files src/dhcp6.c
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/dhcp6.c	Tue May 08 12:27:42 2018 +0100
+++ b/src/dhcp6.c	Tue May 08 12:39:26 2018 +0100
@@ -778,7 +778,13 @@
 		}
 		/* FALLTHROUGH */
 	case DH6S_INIT:
-		len += ifo->ia_len * (sizeof(o) + (sizeof(uint32_t) * 3));
+		for (l = 0; l < ifo->ia_len; l++) {
+			ifia = &ifo->ia[l];
+			len += sizeof(o) + sizeof(uint32_t); /* IAID */
+			/* IA_TA does not have T1 or T2 timers */
+			if (ifo->ia[l].ia_type != D6_OPTION_IA_TA)
+				len += sizeof(uint32_t) + sizeof(uint32_t);
+		}
 		IA = 1;
 		break;
 	default: