@@ -11,7 +11,7 @@
src/preprocessors/Makefile \
diff -uNr snort-2.9.2.2-clean/src/dynamic-preprocessors/ipv6/Makefile.am snort-2.9.2.2/src/dynamic-preprocessors/ipv6/Makefile.am
--- snort-2.9.2.2-clean/src/dynamic-preprocessors/ipv6/Makefile.am 1970-01-01 01:00:00.000000000 +0100
-+++ snort-2.9.2.2/src/dynamic-preprocessors/ipv6/Makefile.am 2012-05-12 20:58:22.853272639 +0200
++++ snort-2.9.2.2/src/dynamic-preprocessors/ipv6/Makefile.am 2012-05-12 23:11:34.989269138 +0200
@@ -0,0 +1,33 @@
+## $Id
+AUTOMAKE_OPTIONS=foreign no-dependencies
@@ -32,617 +32,24 @@
+endif
+
+libsf_ipv6_preproc_la_SOURCES = \
-+sf_ip.c \
+spp_ipv6.c \
+spp_ipv6_constants.h \
+spp_ipv6_data_structs.c \
+spp_ipv6_data_structs.h \
+spp_ipv6.h \
+spp_ipv6_parse.c \
-+spp_ipv6_ruleopt.c
++spp_ipv6_ruleopt.c \
++tree.h
+
+EXTRA_DIST =
+
+all-local: $(LTLIBRARIES)
+ $(MAKE) DESTDIR=`pwd`/../build install-libLTLIBRARIES
+
-diff -uNr snort-2.9.2.2-clean/src/dynamic-preprocessors/ipv6/sf_ip.c snort-2.9.2.2/src/dynamic-preprocessors/ipv6/sf_ip.c
---- snort-2.9.2.2-clean/src/dynamic-preprocessors/ipv6/sf_ip.c 1970-01-01 01:00:00.000000000 +0100
-+++ snort-2.9.2.2/src/dynamic-preprocessors/ipv6/sf_ip.c 2012-05-12 20:58:22.787208307 +0200
-@@ -0,0 +1,589 @@
-+/*
-+** Copyright (C) 1998-2012 Sourcefire, Inc.
-+** Adam Keeton
-+** Kevin Liu <kliu@sourcefire.com>
-+**
-+** $Id$
-+** This program is free software; you can redistribute it and/or modify
-+** it under the terms of the GNU General Public License Version 2 as
-+** published by the Free Software Foundation. You may not use, modify or
-+** distribute this program under any other version of the GNU General
-+** Public License.
-+**
-+** This program is distributed in the hope that it will be useful,
-+** but WITHOUT ANY WARRANTY; without even the implied warranty of
-+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+** GNU General Public License for more details.
-+**
-+** You should have received a copy of the GNU General Public License
-+** along with this program; if not, write to the Free Software
-+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-+*/
-+
-+/*
-+ * Adam Keeton
-+ * sf_ip.c
-+ * 11/17/06
-+ *
-+ * Library for managing IP addresses of either v6 or v4 families.
-+*/
-+
-+#ifdef HAVE_CONFIG_H
-+#include "config.h"
-+#endif
-+
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include <string.h>
-+#include <ctype.h>
-+#include <math.h> /* For ceil */
-+#include "sf_ip.h"
-+
-+/* For inet_pton */
-+#ifndef WIN32
-+#include <sys/types.h>
-+#include <sys/socket.h>
-+#include <arpa/inet.h>
-+#endif /* WIN32 */
-+
-+#if 0
-+/* Support function .. but could see some external uses */
-+static inline int sfip_length(sfip_t *ip) {
-+ ARG_CHECK1(ip, 0);
-+
-+ if(sfip_family(ip) == AF_INET) return 4;
-+ return 16;
-+}
-+#endif
-+
-+/* Support function */
-+// note that an ip6 address may have a trailing dotted quad form
-+// but that it always has at least 2 ':'s; furthermore there is
-+// no valid ip4 format (including mask) with 2 ':'s
-+// we don't have to figure out if the format is entirely legal
-+// we just have to be able to tell correct formats apart
-+static inline int sfip_str_to_fam(const char *str) {
-+ const char* s;
-+ ARG_CHECK1(str, 0);
-+ s = strchr(str, (int)':');
-+ if ( s && strchr(s+1, (int)':') ) return AF_INET6;
-+ if ( strchr(str, (int)'.') ) return AF_INET;
-+ return AF_UNSPEC;
-+}
-+
-+/* Place-holder allocation incase we want to do something more indepth later */
-+static inline sfip_t *_sfip_alloc() {
-+ /* Note: using calloc here instead of SnortAlloc since the dynamic libs
-+ * can't presently resolve SnortAlloc */
-+ return (sfip_t*)calloc(sizeof(sfip_t), 1);
-+}
-+
-+/* Masks off 'val' bits from the IP contained within 'ip' */
-+static inline int sfip_cidr_mask(sfip_t *ip, int val) {
-+ int i;
-+ unsigned int mask = 0;
-+ unsigned int *p;
-+ int index = (int)ceil(val / 32.0) - 1;
-+
-+ ARG_CHECK1(ip, SFIP_ARG_ERR);
-+
-+ p = ip->ip32;
-+
-+ if( val < 0 ||
-+ ((sfip_family(ip) == AF_INET6) && val > 128) ||
-+ ((sfip_family(ip) == AF_INET) && val > 32) ) {
-+ return SFIP_ARG_ERR;
-+ }
-+
-+ /* Build the netmask by converting "val" into
-+ * the corresponding number of bits that are set */
-+ for(i = 0; i < 32- (val - (index * 32)); i++)
-+ mask = (mask<<1) + 1;
-+
-+ p[index] = htonl((ntohl(p[index]) & ~mask));
-+
-+ index++;
-+
-+ /* 0 off the rest of the IP */
-+ for( ; index<4; index++) p[index] = 0;
-+
-+ return SFIP_SUCCESS;
-+}
-+
-+/* Allocate IP address from a character array describing the IP */
-+sfip_t *sfip_alloc(const char *ip, SFIP_RET *status) {
-+ SFIP_RET tmp;
-+ sfip_t *ret;
-+
-+ if(!ip) {
-+ if(status)
-+ *status = SFIP_ARG_ERR;
-+ return NULL;
-+ }
-+
-+ if((ret = _sfip_alloc()) == NULL) {
-+ if(status)
-+ *status = SFIP_ALLOC_ERR;
-+ return NULL;
-+ }
-+
-+ if( (tmp = sfip_pton(ip, ret)) != SFIP_SUCCESS) {
-+ if(status)
-+ *status = tmp;
-+
-+ sfip_free(ret);
-+ return NULL;
-+ }
-+
-+ if(status)
-+ *status = SFIP_SUCCESS;
-+
-+ return ret;
-+}
-+
-+/* Allocate IP address from an array of 8 byte integers */
-+sfip_t *sfip_alloc_raw(void *ip, int family, SFIP_RET *status) {
-+ sfip_t *ret;
-+
-+ if(!ip) {
-+ if(status)
-+ *status = SFIP_ARG_ERR;
-+ return NULL;
-+ }
-+
-+ if((ret = _sfip_alloc()) == NULL) {
-+ if(status)
-+ *status = SFIP_ALLOC_ERR;
-+ return NULL;
-+ }
-+
-+ ret->bits = (family==AF_INET?32:128);
-+ ret->family = family;
-+ /* XXX Replace with appropriate "high speed" copy */
-+ memcpy(ret->ip8, ip, ret->bits/8);
-+
-+ if(status)
-+ *status = SFIP_SUCCESS;
-+
|