068952c
From: Roger Shimizu <rosh@debian.org>
068952c
Date: Sun, 6 Sep 2020 14:36:10 +0900
068952c
Subject: Make sla-id config optional
068952c
068952c
Cherry-pick from Fedora:
068952c
https://src.fedoraproject.org/rpms/wide-dhcpv6/blob/master/f/wide-dhcpv6-0009-Make-sla-id-config-optional.patch
068952c
---
068952c
 config.c | 13 ++++++++++---
068952c
 1 file changed, 10 insertions(+), 3 deletions(-)
068952c
068952c
diff --git a/config.c b/config.c
068952c
index 5829d92..70f6287 100644
068952c
--- a/config.c
068952c
+++ b/config.c
068952c
@@ -126,7 +126,7 @@ extern long long cf_refreshtime;
fa84285
 extern char *configfilename;
fa84285
 
fa84285
 static struct keyinfo *find_keybyname __P((struct keyinfo *, char *));
fa84285
-static int add_pd_pif __P((struct iapd_conf *, struct cf_list *));
fa84285
+static int add_pd_pif __P((struct iapd_conf *, struct cf_list *, u_int32_t));
fa84285
 static int add_options __P((int, struct dhcp6_ifconf *, struct cf_list *));
fa84285
 static int add_prefix __P((struct dhcp6_list *, char *, int,
fa84285
     struct dhcp6_prefix *));
068952c
@@ -358,6 +358,8 @@ configure_ia(ialist, iatype)
fa84285
 	size_t confsize;
fa84285
 	static int init = 1;
fa84285
 
fa84285
+	u_int32_t if_count;
fa84285
+
fa84285
 	if (init) {
fa84285
 		TAILQ_INIT(&ia_conflist0);
fa84285
 		init = 0;
068952c
@@ -403,6 +405,8 @@ configure_ia(ialist, iatype)
fa84285
 			break;
fa84285
 		}
fa84285
 
fa84285
+		if_count = 0;
fa84285
+
fa84285
 		/* set up parameters for the IA */
fa84285
 		for (cfl = iap->params; cfl; cfl = cfl->next) {
fa84285
 			struct iapd_conf *pdp = (struct iapd_conf *) iac;
068952c
@@ -412,8 +416,9 @@ configure_ia(ialist, iatype)
fa84285
 			case IATYPE_PD:
fa84285
 				switch(cfl->type) {
fa84285
 				case IACONF_PIF:
fa84285
-					if (add_pd_pif(pdp, cfl))
fa84285
+					if (add_pd_pif(pdp, cfl, if_count))
fa84285
 						goto bad;
fa84285
+					if_count++;
fa84285
 					break;
fa84285
 				case IACONF_PREFIX:
fa84285
 					if (add_prefix(&pdp->iapd_prefix_list,
068952c
@@ -465,9 +470,10 @@ configure_ia(ialist, iatype)
fa84285
 }
fa84285
 
fa84285
 static int
fa84285
-add_pd_pif(iapdc, cfl0)
fa84285
+add_pd_pif(iapdc, cfl0, if_count)
fa84285
 	struct iapd_conf *iapdc;
fa84285
 	struct cf_list *cfl0;
fa84285
+	u_int32_t if_count;
fa84285
 {
fa84285
 	struct cf_list *cfl;
fa84285
 	struct prefix_ifconf *pif;
068952c
@@ -503,6 +509,7 @@ add_pd_pif(iapdc, cfl0)
fa84285
 		goto bad;
fa84285
 	}
fa84285
 
fa84285
+	pif->sla_id = if_count;
fa84285
 	pif->ifid_len = IFID_LEN_DEFAULT;
fa84285
 	pif->sla_len = SLA_LEN_DEFAULT;
068952c