From owner-svn-src-projects@FreeBSD.ORG Tue Dec 13 09:49:41 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BBF06106564A; Tue, 13 Dec 2011 09:49:41 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A19688FC08; Tue, 13 Dec 2011 09:49:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBD9nfNk042789; Tue, 13 Dec 2011 09:49:41 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBD9nfjG042787; Tue, 13 Dec 2011 09:49:41 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201112130949.pBD9nfjG042787@svn.freebsd.org> From: Lawrence Stewart Date: Tue, 13 Dec 2011 09:49:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228459 - projects/diffused_head/sbin/ipfw X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Dec 2011 09:49:41 -0000 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