Project

General

Profile

Bug #7145 » patch-dhcp6c__script.c

Martin Wasley, 01/25/2017 01:04 AM

 
1
--- dhcp6c_script.c.orig	2016-12-19 08:16:42 UTC
2
+++ dhcp6c_script.c
3
@@ -167,10 +167,35 @@ client6_script(scriptpath, state, optinf
4
 	 */
5
 	i = 0;
6
 	/* reason */
7
+	
8
+	switch (state) {
9
+	case DHCP6S_INFOREQ:
10
+		sprintf(reason,"REASON=INF");
11
+ 		break;  
12
+ 	case DHCP6S_REQUEST:
13
+		sprintf(reason,"REASON=REP");
14
+ 		break;
15
+ 	case DHCP6S_RENEW:
16
+		sprintf(reason,"REASON=REN");
17
+ 		break;
18
+ 	case DHCP6S_REBIND:
19
+		sprintf(reason,"REASON=REB");
20
+ 		break;
21
+ 	case DHCP6S_RELEASE:
22
+		sprintf(reason,"REASON=REL");
23
+ 		break;
24
+ 	case DHCP6S_SOLICIT:
25
+		sprintf(reason,"REASON=OFR");
26
+ 		break;             
27
+	default:
28
+	      sprintf(reason,"REASON=NBI");
29
+	}
30
+	
31
+	
32
 	if ((envp[i++] = strdup(reason)) == NULL) {
33
 		d_printf(LOG_NOTICE, FNAME,
34
 		    "failed to allocate reason strings");
35
-		ret = -1;
36
+		ret = -1; 
37
 		goto clean;
38
 	}
39
 	/* "var=addr1 addr2 ... addrN" + null char for termination */
(2-2/11)