commit 4c9d87ecbf7d3251cb883371ac73080fc784fc96
Author: Jakub Bogusz <[email protected]>
Date:   Tue Dec 19 18:27:47 2017 +0100

    - up to 1.0
    - restored and updated install patch
    - added includes patch (missing libc includes)
    - added iptables patch (recent iptables compatibility)

 linux-igd-includes.patch |  26 +++++++++++
 linux-igd-install.patch  |  28 ++++++++++++
 linux-igd-iptables.patch | 111 +++++++++++++++++++++++++++++++++++++++++++++++
 linux-igd.spec           |  26 ++++++++---
 4 files changed, 184 insertions(+), 7 deletions(-)
---
diff --git a/linux-igd.spec b/linux-igd.spec
index 78c3bc1..61b0952 100644
--- a/linux-igd.spec
+++ b/linux-igd.spec
@@ -1,15 +1,22 @@
-# TODO: %service?
+# TODO: %%service?
+#
+# Conditional build:
+%bcond_without iptables        # iptables/netfilter manipulation support
+
 Summary:       The Linux UPnP Internet Gateway Device
 Summary(pl.UTF-8):     Linuksowa implementacja UPnP Internet Gateway Device
 Name:          linux-igd
-Version:       0.95
+Version:       1.0
 Release:       1
-License:       GPL
+License:       GPL v2
 Group:         Daemons
-Source0:       http://dl.sourceforge.net/linux-igd/linuxigd-%{version}.tar.gz
-# Source0-md5: 0f203a2db5e3fb01496b73e417dbd9a6
-URL:           http://linux-igd.sourceforge.net/
+Source0:       
http://downloads.sourceforge.net/linux-igd/linuxigd-%{version}.tar.gz
+# Source0-md5: 929f5c4878c91d534613b7c7070215d9
 Patch0:                %{name}-install.patch
+Patch1:                %{name}-includes.patch
+Patch2:                %{name}-iptables.patch
+URL:           http://linux-igd.sourceforge.net/
+%{?with_iptables:BuildRequires:        iptables-devel >= 1.6}
 BuildRequires: libupnp-devel
 BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
@@ -28,10 +35,14 @@ Messenger, pracować poprawnie zza linuksowego firewalla z 
NAT-em.
 %prep
 %setup -q -n linuxigd-%{version}
 %patch0 -p1
+%patch1 -p1
+%patch2 -p1
 
 %build
 %{__make} \
-       OPT="%{rpmcflags}"
+       CC="%{__cc}" \
+       CFLAGS="%{rpmcflags} -Wall" \
+       %{?with_iptables:HAVE_LIBIPTC=1}
 
 %install
 rm -rf $RPM_BUILD_ROOT
@@ -51,6 +62,7 @@ fi
 
 %files
 %defattr(644,root,root,755)
+%doc CHANGES INSTALL TODO doc/config_options
 %dir %{_sysconfdir}/linuxigd
 %{_sysconfdir}/linuxigd/*.xml
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/upnpd.conf
diff --git a/linux-igd-includes.patch b/linux-igd-includes.patch
new file mode 100644
index 0000000..7469e8a
--- /dev/null
+++ b/linux-igd-includes.patch
@@ -0,0 +1,26 @@
+--- linuxigd-1.0/gatedevice.c.orig     2007-02-08 00:07:27.000000000 +0100
++++ linuxigd-1.0/gatedevice.c  2017-12-19 17:06:46.347903126 +0100
+@@ -1,4 +1,5 @@
+ #include <syslog.h>
++#include <stdio.h>
+ #include <stdlib.h>
+ #include <upnp/ixml.h>
+ #include <string.h>
+--- linuxigd-1.0/main.c.orig   2006-07-25 22:45:13.000000000 +0200
++++ linuxigd-1.0/main.c        2017-12-19 17:06:11.061236862 +0100
+@@ -1,5 +1,6 @@
+ #include <stdio.h>
+ #include <stdlib.h>
++#include <string.h>
+ #include <unistd.h>
+ #include <syslog.h>
+ #include <signal.h>
+--- linuxigd-1.0/pmlist.c.orig 2006-10-01 17:58:32.000000000 +0200
++++ linuxigd-1.0/pmlist.c      2017-12-19 17:07:26.461235998 +0100
+@@ -1,4 +1,6 @@
++#include <stdio.h>
+ #include <stdlib.h>
++#include <string.h>
+ #include <sys/wait.h>
+ #include <unistd.h>
+ #include <upnp/upnp.h>
diff --git a/linux-igd-install.patch b/linux-igd-install.patch
new file mode 100644
index 0000000..1465d66
--- /dev/null
+++ b/linux-igd-install.patch
@@ -0,0 +1,28 @@
+--- linuxigd-0.95/Makefile     2006-05-23 23:16:36.000000000 +0100
++++ linuxigd-0.95-patch/Makefile       2006-08-14 13:37:42.000000000 +0100
+@@ -33,11 +33,17 @@
+       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/rc.d/init.d/
++      install -d $(DESTDIR)/etc/linuxigd/
++      install -d $(DESTDIR)/etc/sysconfig/
++      install -d $(DESTDIR)/usr/sbin/
++      install -d $(DESTDIR)/usr/share/man/man8/
++      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 etc/upnpd.conf $(DESTDIR)/etc
++      install upnpd $(DESTDIR)/usr/sbin
++      install upnpd.8 $(DESTDIR)/usr/share/man/man8
++      install -D etc/upnpd.rc $(DESTDIR)/etc/rc.d/init.d/upnpd
++      install -D etc/upnpd.rc.conf $(DESTDIR)/etc/sysconfig/upnpd
diff --git a/linux-igd-iptables.patch b/linux-igd-iptables.patch
new file mode 100644
index 0000000..ba8abe8
--- /dev/null
+++ b/linux-igd-iptables.patch
@@ -0,0 +1,111 @@
+--- linuxigd-1.0/iptc.c.orig   2006-09-11 17:55:48.000000000 +0200
++++ linuxigd-1.0/iptc.c        2017-12-19 18:22:25.891184625 +0100
+@@ -4,9 +4,20 @@
+ #include <errno.h>
+ #include <netdb.h>
+ #include <string.h>
++#ifdef OLDIPT
+ #include <iptables.h>
++#endif
+ #include <libiptc/libiptc.h>
++#ifdef OLDIPT
+ #include <linux/netfilter_ipv4/ip_nat.h>
++#else
++#include <linux/netfilter/nf_nat.h>
++#define IP_NAT_RANGE_MAP_IPS NF_NAT_RANGE_MAP_IPS
++#define IP_NAT_RANGE_PROTO_SPECIFIED NF_NAT_RANGE_PROTO_SPECIFIED
++#define ip_nat_range nf_nat_ipv4_range
++#define ip_nat_multi_range nf_nat_ipv4_multi_range_compat
++#define IPT_ALIGN XT_ALIGN
++#endif
+ #include <arpa/inet.h> /* inet_addr */
+ #include "globals.h"
+ #include "util.h"
+@@ -44,7 +55,7 @@
+                    const char *dnat_to,
+                    const int append)
+ {
+-      iptc_handle_t handle;
++      struct iptc_handle *handle;
+       struct ipt_entry *chain_entry;
+       struct ipt_entry_match *entry_match = NULL;
+       struct ipt_entry_target *entry_target = NULL;
+@@ -111,6 +122,7 @@
+       handle = iptc_init(table);
+       if (!handle) {
+               trace(1, "libiptc error: Can't initialize table %s, %s", table, 
iptc_strerror(errno));
++              iptc_free(handle);
+               return;
+       }
+ 
+@@ -118,18 +130,21 @@
+       result = iptc_is_chain(chain, handle);
+       if (!result) {
+               trace(1, "libiptc error: Chain %s does not exist!", chain);
++              iptc_free(handle);
+               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));
++              iptc_free(handle);
+               return;
+       }
+-      result = iptc_commit(&handle);
++      result = iptc_commit(handle);
++      iptc_free(handle);
+       if (!result) {
+         trace(1, "libiptc error: Commit error, %s", iptc_strerror(errno));
+               return;
+@@ -154,7 +169,7 @@
+                       const char *target,
+                       const char *dnat_to)
+ {
+-      iptc_handle_t handle;
++      struct iptc_handle *handle;
+       const struct ipt_entry *e;
+       ipt_chainlabel labelit;
+       int i, result;
+@@ -177,7 +192,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;
+@@ -185,7 +200,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;
+@@ -208,13 +223,15 @@
+               
+               break;
+       }
+-      if (!e) return;
+-      result = iptc_delete_num_entry(chain, i, &handle);
++      if (!e) { iptc_free(handle); return; }
++      result = iptc_delete_num_entry(chain, i, handle);
+       if (!result) {
+         trace(1, "libiptc error: Delete error, %s", iptc_strerror(errno));
++        iptc_free(handle);
+               return;
+       }
+-      result = iptc_commit(&handle);
++      result = iptc_commit(handle);
++      iptc_free(handle);
+       if (!result) {
+         trace(1, "libiptc error: Commit error, %s", iptc_strerror(errno));
+               return;
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/linux-igd.git/commitdiff/4c9d87ecbf7d3251cb883371ac73080fc784fc96

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to