svn commit: r228459 - projects/diffused_head/sbin/ipfw

Lawrence Stewart lstewart at FreeBSD.org
Tue Dec 13 09:49:41 UTC 2011


Author: lstewart
Date: Tue Dec 13 09:49:41 2011
New Revision: 228459
URL: http://svn.freebsd.org/changeset/base/228459

Log:
  Fix a DIFFUSE induced segfault in ipfw: declare, initialise and use list head
  structs instead of pointers to list head structs for feature/classifier modules.

Modified:
  projects/diffused_head/sbin/ipfw/diffuse_modules.c

Modified: projects/diffused_head/sbin/ipfw/diffuse_modules.c
==============================================================================
--- projects/diffused_head/sbin/ipfw/diffuse_modules.c	Tue Dec 13 09:01:44 2011	(r228458)
+++ projects/diffused_head/sbin/ipfw/diffuse_modules.c	Tue Dec 13 09:49:41 2011	(r228459)
@@ -69,11 +69,11 @@ SLIST_HEAD(di_featuremods_head, di_featu
 SLIST_HEAD(di_classifiermods_head, di_classifier_module);
 
 /* List of feature modules. */
-static struct di_featuremods_head *featuremods =
+static struct di_featuremods_head featuremods =
     SLIST_HEAD_INITIALIZER(featuremods);
 
 /* List of classifier modules. */
-static struct di_classifiermods_head *classifiermods =
+static struct di_classifiermods_head classifiermods =
     SLIST_HEAD_INITIALIZER(classifiermods);
 
 struct di_classifier_module *
@@ -83,7 +83,7 @@ find_classifier_module(const char *name)
 
 	tmp = NULL;
 
-	SLIST_FOREACH(tmp, classifiermods, next) {
+	SLIST_FOREACH(tmp, &classifiermods, next) {
 		if (strcmp(tmp->name, name) == 0)
 			break;
 	}
@@ -96,7 +96,7 @@ print_classifier_modules()
 {
 	struct di_classifier_module *tmp;
 
-	SLIST_FOREACH(tmp, classifiermods, next) {
+	SLIST_FOREACH(tmp, &classifiermods, next) {
 		printf("%s ", tmp->name);
 	}
 	printf("\n");
@@ -109,7 +109,7 @@ find_feature_module(const char *name)
 
 	tmp = NULL;
 
-	SLIST_FOREACH(tmp, featuremods, next) {
+	SLIST_FOREACH(tmp, &featuremods, next) {
 		if (strcmp(tmp->name, name) == 0)
 			break;
 	}
@@ -122,7 +122,7 @@ print_feature_modules()
 {
 	struct di_feature_module *tmp;
 
-	SLIST_FOREACH(tmp, featuremods, next) {
+	SLIST_FOREACH(tmp, &featuremods, next) {
 		printf("%s ", tmp->name);
 	}
 	printf("\n");
@@ -132,22 +132,22 @@ void
 diffuse_classifier_modules_init()
 {
 
-	SLIST_INIT(classifiermods);
-	SLIST_INSERT_HEAD(classifiermods, c45_module(), next);
-	SLIST_INSERT_HEAD(classifiermods, nbayes_module(), next);
+	SLIST_INIT(&classifiermods);
+	SLIST_INSERT_HEAD(&classifiermods, c45_module(), next);
+	SLIST_INSERT_HEAD(&classifiermods, nbayes_module(), next);
 }
 
 void
 diffuse_feature_modules_init()
 {
 
-	SLIST_INIT(featuremods);
-	SLIST_INSERT_HEAD(featuremods, iat_module(), next);
-	SLIST_INSERT_HEAD(featuremods, iatbd_module(), next);
-	SLIST_INSERT_HEAD(featuremods, pcnt_module(), next);
-	SLIST_INSERT_HEAD(featuremods, plen_module(), next);
-	SLIST_INSERT_HEAD(featuremods, plenbd_module(), next);
-	SLIST_INSERT_HEAD(featuremods, skype_module(), next);
+	SLIST_INIT(&featuremods);
+	SLIST_INSERT_HEAD(&featuremods, iat_module(), next);
+	SLIST_INSERT_HEAD(&featuremods, iatbd_module(), next);
+	SLIST_INSERT_HEAD(&featuremods, pcnt_module(), next);
+	SLIST_INSERT_HEAD(&featuremods, plen_module(), next);
+	SLIST_INSERT_HEAD(&featuremods, plenbd_module(), next);
+	SLIST_INSERT_HEAD(&featuremods, skype_module(), next);
 }
 
 void


More information about the svn-src-projects mailing list