Update of /cvsroot/leaf/src/bering-uclibc4/source/upnpd
In directory 
sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv18760/source/upnpd

Added Files:
        001-iptables_defs.patch 002-netfilter_nat_headers.patch 
        003-Makefile-fix.patch 004-iptables-1.4.3.2-compat.patch 
        buildtool.cfg buildtool.mk libupnp-1.4.1.tar.gz 
        linuxigd-1.0.tar.gz linuxigd.patch upnpd-default upnpd-init 
Log Message:
Fix/update of upnpd & hostapd


--- NEW FILE: 003-Makefile-fix.patch ---
Index: linuxigd-1.0/Makefile
===================================================================
--- linuxigd-1.0.orig/Makefile  2008-02-27 10:45:26.000000000 +0100
+++ linuxigd-1.0/Makefile       2008-02-27 10:45:54.000000000 +0100
@@ -27,7 +27,7 @@
        @echo "make $@ finished on `date`"
 
 %.o:   %.c
-       $(CC) $(CFLAGS) $(INCLUDES) -c $<
+       $(CC) $(CFLAGS) $(INCLUDES) -D_GNU_SOURCE -c $<
 
 clean:
        rm -f *.o upnpd

--- NEW FILE: libupnp-1.4.1.tar.gz ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: upnpd-default ---
#
# UPnPd         linux-igd ported for leaf
#
# Uncomment these to change defaults.
#
# The current implemetation of UPNPD is capable of dealing with just one
# internal interface (where we listen for control messages) and one external
# interface (where firewall rules are managed).
#
# IF_INTERNAL="eth1"
# IF_EXTERNAL="ppp0"

# By default, we'll add a route for the multicast packets out the
# internal interface.  If you set MC_ROUTE to "", no route will be
# added/managed.
#
# MC_ROUTE="224.0.0.0/4"

--- NEW FILE: 004-iptables-1.4.3.2-compat.patch ---
diff -ur linuxigd-1.0.orig/iptc.c linuxigd-1.0/iptc.c
--- linuxigd-1.0.orig/iptc.c    2009-05-05 14:01:59.000000000 +0200
+++ linuxigd-1.0/iptc.c 2009-05-05 14:05:48.000000000 +0200
@@ -7,16 +7,24 @@
 #include <iptables.h>
 #include <libiptc/libiptc.h>
 #include <linux/version.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
-#include <linux/netfilter/nf_nat.h>
+#ifdef IPTABLES_VERSION >= "1.4.3"
+#  include <net/netfilter/nf_nat.h>
+#  define ip_nat_multi_range nf_nat_multi_range_compat
+#  define ip_nat_range nf_nat_range
 #else
-#include <linux/netfilter_ipv4/ip_nat.h>
+#  if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
+#    include <linux/netfilter/nf_nat.h>
+#  else
+#    include <linux/netfilter_ipv4/ip_nat.h>
+#  endif
 #endif
 #include <arpa/inet.h> /* inet_addr */
 #include "globals.h"
 #include "util.h"
 #include "iptc.h"
 
+#define IPTC_HANDLE struct iptc_handle *
+
 struct ipt_natinfo
 {
        struct ipt_entry_target t;
@@ -49,7 +57,7 @@
                    const char *dnat_to,
                    const int append)
 {
-       iptc_handle_t handle;
+       IPTC_HANDLE handle;
        struct ipt_entry *chain_entry;
        struct ipt_entry_match *entry_match = NULL;
        struct ipt_entry_target *entry_target = NULL;
@@ -126,15 +134,15 @@
                return;
        }
        if (append)
-               result = iptc_append_entry(labelit, chain_entry, &handle);
+               result = iptc_append_entry(labelit, chain_entry, handle);
        else
-               result = iptc_insert_entry(labelit, chain_entry, 0, &handle);
+               result = iptc_insert_entry(labelit, chain_entry, 0, handle);
 
        if (!result) {
                trace(1, "libiptc error: Can't add, %s", iptc_strerror(errno));
                return;
        }
-       result = iptc_commit(&handle);
+       result = iptc_commit(handle);
        if (!result) {
          trace(1, "libiptc error: Commit error, %s", iptc_strerror(errno));
                return;
@@ -159,7 +167,7 @@
                       const char *target,
                       const char *dnat_to)
 {
-       iptc_handle_t handle;
+       IPTC_HANDLE handle;
        const struct ipt_entry *e;
        ipt_chainlabel labelit;
        int i, result;
@@ -182,7 +190,7 @@
        }
        
        /* check through rules to find match */
-       for (e = iptc_first_rule(chain, &handle), i=0; e; e = iptc_next_rule(e, 
&handle), i++)  {
+       for (e = iptc_first_rule(chain, handle), i=0; e; e = iptc_next_rule(e, 
handle), i++)  {
                if (s_src != INADDR_NONE && e->ip.src.s_addr != s_src) continue;
                if (s_dest != INADDR_NONE && e->ip.dst.s_addr != s_dest) 
continue;
                if (iniface && strcmp(e->ip.iniface, iniface) != 0) continue;
@@ -190,7 +198,7 @@
                if (protocol && strcmp(protocol, "TCP") == 0 && e->ip.proto != 
IPPROTO_TCP) continue;
                if (protocol && strcmp(protocol, "UDP") == 0 && e->ip.proto != 
IPPROTO_UDP) continue;
                if ((srcports || destports) && IPT_MATCH_ITERATE(e, matchcmp, 
srcports, destports) == 0) continue;
-               if (target && strcmp(target, iptc_get_target(e, &handle)) != 0) 
continue;
+               if (target && strcmp(target, iptc_get_target(e, handle)) != 0) 
continue;
                if (dnat_to && strcmp(target, "DNAT") == 0) {
                        struct ipt_entry_target *t;
                        struct ip_nat_multi_range *mr;
@@ -214,12 +222,12 @@
                break;
        }
        if (!e) return;
-       result = iptc_delete_num_entry(chain, i, &handle);
+       result = iptc_delete_num_entry(chain, i, handle);
        if (!result) {
          trace(1, "libiptc error: Delete error, %s", iptc_strerror(errno));
                return;
        }
-       result = iptc_commit(&handle);
+       result = iptc_commit(handle);
        if (!result) {
          trace(1, "libiptc error: Commit error, %s", iptc_strerror(errno));
                return;

--- NEW FILE: 001-iptables_defs.patch ---
diff -urN linuxigd-1.0/iptc.c linuxigd-1.0.new/iptc.c
--- linuxigd-1.0/iptc.c 2006-09-11 17:55:48.000000000 +0200
+++ linuxigd-1.0.new/iptc.c     2007-06-02 12:24:34.000000000 +0200
@@ -22,9 +22,9 @@
 struct ipt_entry_match *get_udp_match(const char *sports, const char *dports, 
unsigned int *nfcache);
 struct ipt_entry_target *get_dnat_target(const char *input, unsigned int 
*nfcache);
 
-static u_int16_t parse_port(const char *port);
-static void parse_ports(const char *portstring, u_int16_t *ports);
-static int service_to_port(const char *name);
+static u_int16_t igd_parse_port(const char *port);
+void parse_ports(const char *portstring, u_int16_t *ports);
+static int igd_service_to_port(const char *name);
 
 static void parse_range(const char *input, struct ip_nat_range *range);
 static struct ipt_natinfo *append_range(struct ipt_natinfo *info, const struct 
ip_nat_range *range);
@@ -336,13 +336,12 @@
 }
 
 /* Copied and modified from libipt_tcp.c and libipt_udp.c */
-
 static u_int16_t
-parse_port(const char *port)
+igd_parse_port(const char *port)
 {
        unsigned int portnum;
 
-       if ((portnum = service_to_port(port)) != -1) {
+       if ((portnum = igd_service_to_port(port)) != -1) {
                return (u_int16_t)portnum;
        }
        else {
@@ -350,7 +349,7 @@
        }
 }
 
-static void
+void
 parse_ports(const char *portstring, u_int16_t *ports)
 {
        char *buffer;
@@ -358,19 +357,18 @@
 
        buffer = strdup(portstring);
        if ((cp = strchr(buffer, ':')) == NULL)
-               ports[0] = ports[1] = parse_port(buffer);
+               ports[0] = ports[1] = igd_parse_port(buffer);
        else {
                *cp = '\0';
                cp++;
 
-               ports[0] = buffer[0] ? parse_port(buffer) : 0;
-               ports[1] = cp[0] ? parse_port(cp) : 0xFFFF;
+               ports[0] = buffer[0] ? igd_parse_port(buffer) : 0;
+               ports[1] = cp[0] ? igd_parse_port(cp) : 0xFFFF;
        }
        free(buffer);
 }
-
 static int
-service_to_port(const char *name)
+igd_service_to_port(const char *name)
 {
        struct servent *service;
 
@@ -382,7 +380,6 @@
 
 
 
-
 /* Copied and modified from libipt_DNAT.c */
 
 static void

--- NEW FILE: 002-netfilter_nat_headers.patch ---
diff -urN linuxigd-1.0/iptc.c linuxigd-1.0.new/iptc.c
--- linuxigd-1.0/iptc.c 2006-09-11 17:55:48.000000000 +0200
+++ linuxigd-1.0.new/iptc.c     2007-07-13 14:50:23.000000000 +0200
@@ -6,7 +6,12 @@
 #include <string.h>
 #include <iptables.h>
 #include <libiptc/libiptc.h>
+#include <linux/version.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
+#include <linux/netfilter/nf_nat.h>
+#else
 #include <linux/netfilter_ipv4/ip_nat.h>
+#endif
 #include <arpa/inet.h> /* inet_addr */
 #include "globals.h"
 #include "util.h"

--- NEW FILE: linuxigd.patch ---
diff -urN linuxigd-0.95.orig/Makefile linuxigd-0.95/Makefile
--- linuxigd-0.95.orig/Makefile 2006-05-24 00:16:36.000000000 +0200
+++ linuxigd-0.95/Makefile      2006-11-12 22:15:17.000000000 +0100
@@ -33,11 +33,11 @@
        rm -f *.o upnpd
 
 install: upnpd
-       install -d /etc/linuxigd
-       install etc/gatedesc.xml /etc/linuxigd
-       install etc/gateconnSCPD.xml  /etc/linuxigd
-       install etc/gateicfgSCPD.xml /etc/linuxigd
-       install etc/dummy.xml /etc/linuxigd
-       install upnpd $(PREFIX)/sbin
-       install upnpd.8 $(PREFIX)/share/man/man8
-       if [ ! -f /etc/upnpd.conf ]; then install etc/upnpd.conf /etc; fi
+       install -d $(DESTDIR)/etc/linuxigd
+       install -d $(DESTDIR)/$(PREFIX)/sbin
+       install etc/gatedesc.xml $(DESTDIR)/etc/linuxigd
+       install etc/gateconnSCPD.xml $(DESTDIR)/etc/linuxigd
+       install etc/gateicfgSCPD.xml $(DESTDIR)/etc/linuxigd
+       install etc/dummy.xml $(DESTDIR)/etc/linuxigd
+       install upnpd $(DESTDIR)/$(PREFIX)/sbin
+       install etc/upnpd.conf $(DESTDIR)/etc/upnpd.conf
diff -urN linuxigd-0.95.orig/etc/upnpd.conf linuxigd-0.95/etc/upnpd.conf
--- linuxigd-0.95.orig/etc/upnpd.conf   2006-02-02 00:53:39.000000000 +0100
+++ linuxigd-0.95/etc/upnpd.conf        2006-11-12 22:15:08.000000000 +0100
@@ -28,13 +28,17 @@
 # allowed values: a-z, A-Z, _, -
 # default = FORWARD
 #
-forward_chain_name = FORWARD
+#forward_chain_name = FORWARD
 
 #
 # The name of the chain to put prerouting rules in.
 # allowed values: a-z, A-Z, _, -
 # default = PREROUTING
-prerouting_chain_name = PREROUTING 
+#prerouting_chain_name = PREROUTING 
+
+# modified for intergration with shorewall
+forward_chain_name = forwardUPnP
+prerouting_chain_name = UPnP
 
 #
 # The internet line upstream bit rate reported from
@@ -46,7 +50,7 @@
 # The internet line downstream bit rate reported from
 # the daemon. Value in bits per second
 # default = 0
-downstream_bitrate = 512000
+downstream_bitrate = 1512000
 
 #
 # The default duration of port mappings, used when the client

--- NEW FILE: buildtool.mk ---
######################################
#
# buildtool make file for libupnp & linux-igd
#
######################################

include $(MASTERMAKEFILE)

TARGET_DIR=$(BT_BUILD_DIR)/upnpd

UPNPD_DIR:=linuxigd-1.0
LIBUPNP_DIR:=libupnp-1.4.1

# ----------------------------------------------------------------------

LIBUPNP_FLAGS= CC=$(TARGET_CC) LD=$(TARGET_LD) DESTDIR=$(TARGET_DIR)

$(LIBUPNP_DIR)/.source:
        zcat $(LIBUPNP_SOURCE) | tar -xvf -
        touch $(LIBUPNP_DIR)/.source    

$(LIBUPNP_DIR)/.configured: $(LIBUPNP_DIR)/.source
        (cd $(LIBUPNP_DIR); CFLAGS="$(BT_COPT_FLAGS)" CC=$(TARGET_CC) 
LD=$(TARGET_LD) \
        ./configure --prefix=/usr --disable-shared );
        touch $(LIBUPNP_DIR)/.configured

$(LIBUPNP_DIR)/.build: $(LIBUPNP_DIR)/.configured
        mkdir -p $(TARGET_DIR)
        make -C $(LIBUPNP_DIR) $(LIBUPNP_FLAGS)
        make -C $(LIBUPNP_DIR) $(LIBUPNP_FLAGS) install
        touch $(LIBUPNP_DIR)/.build

# ----------------------------------------------------------------------

UPNPD_FLAGS=$(DEBUG) HAVE_LIBIPTC=YES \
        LIBUPNP_PREFIX=$(TARGET_DIR)/usr \
        LIBIPTC_PREFIX=$(TARGET_DIR)/usr \
        CC=$(TARGET_CC) LD=$(TARGET_LD) \
        CFLAGS="$(BT_COPT_FLAGS)" \
        DESTDIR=$(TARGET_DIR)

$(UPNPD_DIR)/.source:
        zcat $(LINUXIGD_SOURCE) | tar -xvf -
        cat $(LINUXIGD_PATCH1) | patch -d $(UPNPD_DIR) -p1
        cat $(LINUXIGD_PATCH2) | patch -d $(UPNPD_DIR) -p1
        cat $(LINUXIGD_PATCH3) | patch -d $(UPNPD_DIR) -p1
        cat $(LINUXIGD_PATCH4) | patch -d $(UPNPD_DIR) -p1
        cat $(LINUXIGD_PATCH5) | patch -d $(UPNPD_DIR) -p1
        touch $(UPNPD_DIR)/.source

$(UPNPD_DIR)/.build: $(UPNPD_DIR)/.source $(LIBUPNP_DIR)/.build
        make -C $(UPNPD_DIR) $(UPNPD_FLAGS)
        make -C $(UPNPD_DIR) $(UPNPD_FLAGS) install
        cp $(UPNPD_DIR)/etc/ligd.gif    $(TARGET_DIR)/etc/linuxigd
        $(BT_STRIP) $(BT_STRIP_BINOPTS) $(TARGET_DIR)/usr/sbin/upnpd
        touch $(UPNPD_DIR)/.build

# ----------------------------------------------------------------------

.build:
        install -d $(TARGET_DIR)/etc/default
        install -d $(TARGET_DIR)/etc/init.d
        cp upnpd-default        $(TARGET_DIR)/etc/default/upnpd
        cp upnpd-init           $(TARGET_DIR)/etc/init.d/upnpd
        touch .build

# ----------------------------------------------------------------------

source: $(LIBUPNP_DIR)/.source $(UPNPD_DIR)/.source

build:  $(UPNPD_DIR)/.build .build
        cp -af $(TARGET_DIR)/* $(BT_STAGING_DIR)

clean:  stageclean
        @if [ -d $(UPNPD_DIR) ]   ; then make -C $(UPNPD_DIR) clean ; fi
        @if [ -d $(LIBUPNP_DIR) ] ; then make -C $(LIBUPNP_DIR)/upnp clean ; fi
        rm -rf $(TARGET_DIR)
        rm -f  $(LIBUPNP_DIR)/.build
        rm -f  $(UPNPD_DIR)/.build
        rm -f  .build

stageclean:
        rm -rf $(BT_STAGING_DIR)/etc/linuxigd
        rm -f  $(BT_STAGING_DIR)/etc/init.d/upnpd
        rm -f  $(BT_STAGING_DIR)/etc/default/upnpd
        rm -f  $(BT_STAGING_DIR)/usr/sbin/upnpd
        rm -f  $(BT_STAGING_DIR)/usr/lib/libupnp*
        rm -f  $(BT_STAGING_DIR)/usr/lib/libixml*
        rm -f  $(BT_STAGING_DIR)/usr/lib/libthreadutil*
        rm -rf $(BT_STAGING_DIR)/usr/include/upnp

srcclean: clean
        rm -rf $(UPNPD_DIR)
        rm -rf $(LIBUPNP_DIR)

--- NEW FILE: buildtool.cfg ---
<File buildtool.mk>
        Server = cvs-contrib-sourceforge
        Revision = HEAD
        Directory = upnpd
</File>

# ---------------------------------------------------------------------

# linux-igd was taken from CVS at sourceforge and archived by hand
# cvs -d :pserver:[email protected]/cvsroot/linux-igd co linux-igd
# tar cvfz linux-igd_cvs<date>.orig.tar.gz

<File linuxigd-1.0.tar.gz>
        Server = cvs-contrib-sourceforge
        Revision = HEAD
        Directory = upnpd
        Envname = LINUXIGD_SOURCE
</File>

<File linuxigd.patch>
        Server = cvs-contrib-sourceforge
        Revision = HEAD
        Directory = upnpd
        Envname = LINUXIGD_PATCH1
</File>

<File 001-iptables_defs.patch>
        Server = cvs-contrib-sourceforge
        Revision = HEAD
        Directory = upnpd
        Envname = LINUXIGD_PATCH2
</File>

<File 002-netfilter_nat_headers.patch>
        Server = cvs-contrib-sourceforge
        Revision = HEAD
        Directory = upnpd
        Envname = LINUXIGD_PATCH3
</File>

<File 003-Makefile-fix.patch>
        Server = cvs-contrib-sourceforge
        Revision = HEAD
        Directory = upnpd
        Envname = LINUXIGD_PATCH4
</File>

<File 004-iptables-1.4.3.2-compat.patch>
        Server = cvs-contrib-sourceforge
        Revision = HEAD
        Directory = upnpd
        Envname = LINUXIGD_PATCH5
</File>

# ---------------------------------------------------------------------

<File libupnp-1.4.1.tar.gz>
        Server = cvs-contrib-sourceforge
        Revision = HEAD
        Directory = upnpd
        Envname = LIBUPNP_SOURCE
</File>

# ---------------------------------------------------------------------

<File upnpd-init>
        Server = cvs-contrib-sourceforge
        Revision = HEAD
        Directory = upnpd
</File>

<File upnpd-default>
        Server = cvs-contrib-sourceforge
        Revision = HEAD
        Directory = upnpd
</File>

# ---------------------------------------------------------------------

<Package>
        <upnpd>
                Version 1.0
                Revision = 1

                Help <<EOF
                Universal Plug-N-Play Internet Gateway Device services
                Homepage: http://linux-igd.sourceforge.net
                Requires: lpthread.lrp, iptables.lrp

                LEAF package by __PACKAGER__, __BUILDDATE__

                This package allows UPnP control points (clients) to
                query the router for statistics and manipulate firewall
                and NAT traversal rules.

                WARNING: UPnP IGD services are designed to work in a
                SOHO environment where all control points are implicitly
                trusted.  Please read the warning in the UPnP chapter in
                the Bering-uClibc user's guide before deploying.
                EOF

                <Permissions>
                        Files = 644
                        Directories = 755
                </Permissions>

                <Owner>
                        Files = root:root
                        Directories = root:root
                </Owner>

                <Contents>
                        <File>
                                Filename    = usr/sbin/upnpd
                                Source      = usr/sbin/upnpd
                                Permissions = 755
                                Type        = binary
                        </File>
                        <File>
                                Filename    = etc/init.d/upnpd
                                Source      = etc/init.d/upnpd
                                Permissions = 755
                                Type        = binary
                        </File>
                        <File>
                                Filename    = etc/upnpd.conf
                                Source      = etc/upnpd.conf
                                Description = UPnP configuration
                                Type        = binary
                                Type        = conf
                                Type        = local
                        </File>
                        <File>
                                Filename    = etc/default/upnpd
                                Source      = etc/default/upnpd
                                Description = UPnP startup configuration
                                Type        = binary
                                Type        = conf
                                Type        = local
                        </File>
                        <File>
                                Filename    = etc/linuxigd/
                                Source      = etc/linuxigd/*.xml
                                Type        = binary
                        </File>
                        <File>
                                Filename    = etc/linuxigd/
                                Source      = etc/linuxigd/*.gif
                                Type        = binary
                        </File>
                </Contents>
        </upnpd>
</Package>

--- NEW FILE: upnpd-init ---
#!/bin/sh
#
# UPnPd         linux-igd ported for leaf
#
RCDLINKS="0,K90 1,K90 2,S90 3,S90 4,S90 5,S90 6,K90"
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/upnpd
NAME=upnpd
DESC=upnpd
PIDFILE=/var/run/${NAME}.pid

test -f $DAEMON || exit 0

IF_INTERNAL="eth1"
IF_EXTERNAL="ppp0"

# SSDP announcements go out on 239.255.255.250
# IGMP joins go out on 224.0.0.22
#
# Our choices are to set MC_ROUTE for just SSDP, for all of Multicast,
# or leave it empty and let the user manage multicast routing on his own.
# By default, we'll do all of multicast, as most users using upnpd will
# be two-port SOHO gateways anyway...
#
MC_ROUTE="224.0.0.0/4"

#
# Override defaults in this script for upnpd
#
if [ -f /etc/default/upnpd ] ; then
        . /etc/default/upnpd
fi

set -e

case "$1" in
  start)
        echo -n "Starting $DESC: "

        if [ -n "$MC_ROUTE" ] ; then
                ip route add $MC_ROUTE dev $IF_INTERNAL
        fi

        start-stop-daemon --quiet --start --exec $DAEMON \
                -- $IF_EXTERNAL $IF_INTERNAL
        echo "$NAME."
        ;;
  stop)
        echo -n "Stopping $DESC: "
        start-stop-daemon --quiet --oknodo --stop --exec $DAEMON
        
        sleep 1
        if [ -n "$MC_ROUTE" ] ; then
                ip route delete $MC_ROUTE dev $IF_INTERNAL
        fi              
        
        echo "$NAME."
        ;;
  reload)
        killall -HUP $NAME &2> /dev/null 
        ;;
  restart)
        echo -n "Restarting $DESC: "
        start-stop-daemon --quiet --stop --exec $DAEMON
        sleep 3
        start-stop-daemon --quiet --start --exec $DAEMON \
                -- $IF_EXTERNAL $IF_INTERNAL
        echo "$NAME."
        ;;
  *)
        N=/etc/init.d/$NAME
        echo "Usage: $N {start|stop|reload|restart}" >&2
        exit 1
        ;;
esac

exit 0

--- NEW FILE: linuxigd-1.0.tar.gz ---
(This appears to be a binary file; contents omitted.)


------------------------------------------------------------------------------

_______________________________________________
leaf-cvs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/leaf-cvs-commits

Reply via email to