# HG changeset patch # User Mike Sullivan # Date 1311100623 25200 # Node ID 94dd0f399cc8d42a5a0b96860c8b6b9aca9da626 # Parent 7e9271728c1e87646e31464549f96fa575c9e2c1 7067759 I cast Ressurect Libnet diff -r 7e9271728c1e -r 94dd0f399cc8 components/libnet/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/components/libnet/Makefile Tue Jul 19 11:37:03 2011 -0700 @@ -0,0 +1,60 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. +# + +include ../../make-rules/shared-macros.mk + +COMPONENT_NAME= libnet +COMPONENT_VERSION= 1.1.2.1 +COMPONENT_SRC= $(COMPONENT_NAME)-$(COMPONENT_VERSION) +COMPONENT_PROJECT_URL= http://www.packetfactory.net/libnet/ +COMPONENT_ARCHIVE= $(COMPONENT_SRC).tar.gz +COMPONENT_ARCHIVE_HASH= sha1:9dca91ee0f19b1b9e5e60baaedb9bc44a30a1fc7 +COMPONENT_ARCHIVE_URL= http://www.packetfactory.net/libnet/dist/deprecated/$(COMPONENT_ARCHIVE) + +include ../../make-rules/prep.mk +include ../../make-rules/configure.mk +include ../../make-rules/ips.mk + +COMPONENT_PRE_CONFIGURE_ACTION = \ + ($(CLONEY) $(SOURCE_DIR) $(@D)) + +PKG_PROTO_DIRS += $(COMPONENT_SRC)/doc/man/man3 +COMPILER= gcc +CFLAGS += -g -fPIC +CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)" +CONFIGURE_OPTIONS.32 += --srcdir=$(BUILD_DIR_32) +CONFIGURE_OPTIONS.64 += --srcdir=$(BUILD_DIR_64) + + +# common targets +build: $(BUILD_32_and_64) + +install: $(INSTALL_32_and_64) + +test: $(NO_TESTS) + +BUILD_PKG_DEPENDENCIES = $(BUILD_TOOLS) + +include ../../make-rules/depend.mk diff -r 7e9271728c1e -r 94dd0f399cc8 components/libnet/libnet.license --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/components/libnet/libnet.license Tue Jul 19 11:37:03 2011 -0700 @@ -0,0 +1,35 @@ +Copyright (c) 1998 - 2004 Mike D. Schiffman +Copyright (c) 2003 Frederic Raynal +Copyright (c) 2002 Jose Nazario +Copyright (c) 2002 - 2003 Roberto Larcher +Copyright (c) 1999, 2000 Andrew Reiter +Copyright (c) 2001 - 2002 Don Bowman +Copyright 1988, 1989, 1991, 1992 by Carnegie Mellon University +Copyright (c) 1993, 1994, 1995, 1996, 1998 + The Regents of the University of California. + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + + diff -r 7e9271728c1e -r 94dd0f399cc8 components/libnet/libnet.p5m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/components/libnet/libnet.p5m Tue Jul 19 11:37:03 2011 -0700 @@ -0,0 +1,66 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. +# + + default mangler.man.stability uncommitted> + +set name=pkg.fmri value=pkg:/system/library/libnet@$(IPS_COMPONENT_VERSION),$(BUILD_VERSION) +set name=pkg.summary value="libnet - a library for portable network packet construction" +set name=info.classification value="org.opensolaris.category.2008:System/Libraries" +set name=info.upstream_url value=$(COMPONENT_PROJECT_URL) +set name=info.source_url value=$(COMPONENT_ARCHIVE_URL) +set name=opensolaris.arc_url \ + value=http://arc.opensolaris.org/caselog/PSARC/2008/409 +set name=org.opensolaris.consolidation value=$(CONSOLIDATION) + +license libnet.license license='BSD' + +dir path=usr +dir path=usr/include +dir path=usr/include/libnet +dir path=usr/lib +dir path=usr/lib/$(MACH64) +dir path=usr/share +dir path=usr/share/man +dir path=usr/share/man/man3 +file path=usr/include/libnet.h +file path=usr/include/libnet/libnet-asn1.h +file path=usr/include/libnet/libnet-functions.h +file path=usr/include/libnet/libnet-headers.h +file path=usr/include/libnet/libnet-macros.h +file path=usr/include/libnet/libnet-structures.h +file path=usr/include/libnet/libnet-types.h +file usr/lib/$(MACH64)/libnet.so path=usr/lib/$(MACH64)/libnet.so.1.1.2.1 +file usr/lib/libnet.so path=usr/lib/libnet.so.1.1.2.1 +file libnet-functions.h.3 path=usr/share/man/man3/libnet-functions.h.3 +file libnet-headers.h.3 path=usr/share/man/man3/libnet-headers.h.3 +file libnet-macros.h.3 path=usr/share/man/man3/libnet-macros.h.3 +file libnet.h.3 path=usr/share/man/man3/libnet.h.3 +file libnet_802_1q_hdr.3 path=usr/share/man/man3/libnet_802_1q_hdr.3 +file libnet_802_1x_hdr.3 path=usr/share/man/man3/libnet_802_1x_hdr.3 +link path=usr/lib/$(MACH64)/libnet.so target=libnet.so.1.1.2.1 +link path=usr/lib/libnet.so target=libnet.so.1.1.2.1 + +legacy pkg=SUNWlibnet \ + desc="libnet - a library for portable network packet construction (1.1.2.1)" \ + name=libnet + diff -r 7e9271728c1e -r 94dd0f399cc8 components/libnet/patches/libnet_link_dlpi.c.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/components/libnet/patches/libnet_link_dlpi.c.patch Tue Jul 19 11:37:03 2011 -0700 @@ -0,0 +1,115 @@ +--- libnet-1.1.2.1/src/libnet_link_dlpi.c.orig Thu Jul 14 14:55:07 2011 ++++ libnet-1.1.2.1/src/libnet_link_dlpi.c Thu Jul 14 14:55:27 2011 +@@ -123,6 +123,9 @@ + int8_t dname2[100]; + #endif + ++ int8_t dev_net_dname[200]; ++ uint32_t dev_str_len; ++ + if (l == NULL) + { + return (-1); +@@ -130,21 +133,23 @@ + + /* + * Determine device and ppa ++ * ppa is the last numeric token in the datalink name + */ +- cp = strpbrk(l->device, "0123456789"); +- if (cp == NULL) +- { ++ ++ eos = l->device; ++ ppa = -1; ++ do { ++ cp = strpbrk(eos, "0123456789"); ++ if (cp != NULL) { ++ ppa = strtol(cp, &eos, 10); ++ } ++ } while (*eos != '\0' && cp != NULL); ++ ++ if (ppa == -1) { + snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, +- "%s(): %s is missing unit number\n", __func__, l->device); +- goto bad; ++ "%s(): %s is missing unit number\n", __func__, l->device); ++ goto bad; + } +- ppa = strtol(cp, &eos, 10); +- if (*eos != '\0') +- { +- snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, +- "%s(): %s bad unit number\n", __func__, l->device); +- goto bad; +- } + + if (*(l->device) == '/') + { +@@ -157,6 +162,7 @@ + sprintf(dname, "%s/%s", DLPI_DEV_PREFIX, l->device); + } + #ifdef HAVE_DEV_DLPI ++ + /* + * Map network device to /dev/dlpi unit + */ +@@ -179,6 +185,7 @@ + goto bad; + } + #else ++ + /* + * Try device without unit number + */ +@@ -186,6 +193,40 @@ + cp = strchr(dname, *cp); + *cp = '\0'; + ++ /* ++ * First try the /dev/net vanity device name: ++ * /dev/net/ (DLPI style 1), ++ * and then fallback to the original device name. ++ */ ++ dev_str_len = strlen("/dev/"); ++ memset(dev_net_dname, 0, sizeof(dev_net_dname)); ++ ++ if(strlen(dname2) > dev_str_len) { ++ snprintf(dev_net_dname, sizeof(dev_net_dname), ++ "/dev/net/%s", dname2+dev_str_len); ++ } ++ ++ l->fd = open(dev_net_dname, O_RDWR); ++ ++ if(l->fd == -1) { ++ goto old_style_open; ++ } ++ ++ cp = dev_net_dname; ++ while(*cp && !isdigit((int)*cp)) { ++ cp++; ++ } ++ if(*cp) { ++ ppa = atoi(cp); ++ } else { ++ ppa = 0; ++ } ++ ++ goto opened_device; ++ ++ /* If opening device via /dev/net fails */ ++ old_style_open: ++ + l->fd = open(dname, O_RDWR); + if (l->fd == -1) + { +@@ -223,6 +264,9 @@ + ppa = 0; + } + #endif ++ ++ opened_device: ++ + /* + * Attach if "style 2" provider + */ diff -r 7e9271728c1e -r 94dd0f399cc8 components/libnet/patches/makefile.in.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/components/libnet/patches/makefile.in.patch Tue Jul 19 11:37:03 2011 -0700 @@ -0,0 +1,41 @@ +--- libnet-1.1.2.1/src/Makefile.in.orig Thu Jul 14 14:55:19 2011 ++++ libnet-1.1.2.1/src/Makefile.in Thu Jul 14 14:55:34 2011 +@@ -109,7 +109,7 @@ + + DISTCLEANFILES = *~ + +-lib_LIBRARIES = libnet.a ++lib_LIBRARIES = libnet.a libnet.so + + libnet_a_SOURCES = libnet_asn1.c \ + libnet_build_802.1q.c \ +@@ -163,7 +163,7 @@ + libnet_link_dlpi.c \ + libnet_link_linux.c \ + libnet_link_nit.c \ +- libnet_link_none.c \ ++ libnet_link_none.c \ + libnet_link_pf.c \ + libnet_link_snit.c \ + libnet_link_snoop.c \ +@@ -269,6 +269,10 @@ + $(libnet_a_AR) libnet.a $(libnet_a_OBJECTS) $(libnet_a_LIBADD) + $(RANLIB) libnet.a + ++libnet.so: $(libnet_a_OBJECTS) $(libnet_a_DEPENDENCIES) ++ -rm -f libnet.so ++ $(CC) $(CFLAGS) -shared -o libnet.so $(libnet_a_OBJECTS) $(libnet_a_LIBADD) -Wl,-soname=libnet.so ++ + mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +@@ -379,6 +383,9 @@ + + clean-am: clean-generic clean-libLIBRARIES mostlyclean-am + ++clean-obj: ++ rm -f *.o ++ + distclean: distclean-am + + distclean-am: clean-am distclean-compile distclean-generic \ diff -r 7e9271728c1e -r 94dd0f399cc8 components/meta-packages/history/SUNWlibnet.p5m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/components/meta-packages/history/SUNWlibnet.p5m Tue Jul 19 11:37:03 2011 -0700 @@ -0,0 +1,28 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. +# + +set name=pkg.fmri value=pkg:/SUNWlibnet@1.1.2.1,5.11-0.133 +set name=pkg.renamed value=true +set name=org.opensolaris.consolidation value=$(CONSOLIDATION) + +depend fmri=system/library/libnet@1.1.2.1-0.133 type=require