1
1

Initial dump from Zyxel

This commit is contained in:
2026-04-17 17:00:52 +02:00
commit 81fec250f4
23116 changed files with 5231237 additions and 0 deletions
@@ -0,0 +1,21 @@
--- miniupnpd-1.6/upnpdescstrings.h 2007-02-09 18:13:21.000000000 +0800
+++ miniupnpd-1.6/upnpdescstrings.h 2012-03-20 18:02:22.566674222 +0800
@@ -10,12 +10,12 @@
#include "config.h"
/* strings used in the root device xml description */
-#define ROOTDEV_FRIENDLYNAME OS_NAME " router"
-#define ROOTDEV_MANUFACTURER OS_NAME
-#define ROOTDEV_MANUFACTURERURL OS_URL
-#define ROOTDEV_MODELNAME OS_NAME " router"
-#define ROOTDEV_MODELDESCRIPTION OS_NAME " router"
-#define ROOTDEV_MODELURL OS_URL
+#define ROOTDEV_FRIENDLYNAME "ZyXEL Router"
+#define ROOTDEV_MANUFACTURER "ZyXEL Communications Corp."
+#define ROOTDEV_MANUFACTURERURL "http://www.zyxel.com"
+#define ROOTDEV_MODELNAME "ZyXEL Router"
+#define ROOTDEV_MODELDESCRIPTION "ZyXEL Router"
+#define ROOTDEV_MODELURL ""
#define WANDEV_FRIENDLYNAME "WANDevice"
#define WANDEV_MANUFACTURER "MiniUPnP"
@@ -0,0 +1,10 @@
--- miniupnpd-1.6/Makefile.linux 2011-07-30 21:15:24.000000000 +0800
+++ miniupnpd-1.6/Makefile.linux 2012-03-20 18:22:18.130702388 +0800
@@ -132,6 +132,7 @@
endif
miniupnpd: $(BASEOBJS) $(LNXOBJS) $(NETFILTEROBJS) $(LIBS)
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(BASEOBJS) $(LNXOBJS) $(NETFILTEROBJS) $(LIBS)
testupnpdescgen: $(TESTUPNPDESCGENOBJS)
@@ -0,0 +1,107 @@
--- miniupnpd/upnphttp.c 2011-10-17 04:00:00.000000000 +0400
+++ miniupnpd.new/upnphttp.c 2011-10-17 16:56:49.000000000 +0400
@@ -17,6 +17,7 @@
#include <arpa/inet.h>
#include <syslog.h>
#include <ctype.h>
+#include <errno.h>
#include "config.h"
#include "upnphttp.h"
#include "upnpdescgen.h"
@@ -180,7 +181,6 @@ Send404(struct upnphttp * h)
BuildResp2_upnphttp(h, 404, "Not Found",
body404, sizeof(body404) - 1);
SendResp_upnphttp(h);
- CloseSocket_upnphttp(h);
}
/* very minimalistic 501 error message */
@@ -210,7 +209,6 @@ Send501(struct upnphttp * h)
BuildResp2_upnphttp(h, 501, "Not Implemented",
body501, sizeof(body501) - 1);
SendResp_upnphttp(h);
- CloseSocket_upnphttp(h);
}
static const char *
@@ -240,7 +238,6 @@ sendDummyDesc(struct upnphttp * h)
"</scpd>\r\n";
BuildResp_upnphttp(h, xml_desc, sizeof(xml_desc)-1);
SendResp_upnphttp(h);
- CloseSocket_upnphttp(h);
}
#endif
@@ -265,7 +262,6 @@ sendXMLdesc(struct upnphttp * h, char *
BuildResp_upnphttp(h, desc, len);
}
SendResp_upnphttp(h);
- CloseSocket_upnphttp(h);
free(desc);
}
@@ -294,7 +290,6 @@ ProcessHTTPPOST_upnphttp(struct upnphttp
BuildResp2_upnphttp(h, 400, "Bad Request",
err400str, sizeof(err400str) - 1);
SendResp_upnphttp(h);
- CloseSocket_upnphttp(h);
}
}
else
@@ -383,7 +378,6 @@ ProcessHTTPSubscribe_upnphttp(struct upn
* the publisher must respond with HTTP error 412 Precondition Failed*/
BuildResp2_upnphttp(h, 412, "Precondition Failed", 0, 0);
SendResp_upnphttp(h);
- CloseSocket_upnphttp(h);
} else {
/* - add to the subscriber list
* - respond HTTP/x.x 200 OK
@@ -422,7 +416,6 @@ with HTTP error 412 Precondition Failed.
}
}
SendResp_upnphttp(h);
- CloseSocket_upnphttp(h);
}
}
@@ -438,7 +431,6 @@ ProcessHTTPUnSubscribe_upnphttp(struct u
BuildResp_upnphttp(h, 0, 0);
}
SendResp_upnphttp(h);
- CloseSocket_upnphttp(h);
}
#endif
@@ -733,6 +726,8 @@ SendResp_upnphttp(struct upnphttp * h)
if(n<0)
{
syslog(LOG_ERR, "send(res_buf): %m");
+ if (errno != EINTR)
+ break;
}
else if(n == 0)
{
@@ -746,5 +741,6 @@ SendResp_upnphttp(struct upnphttp * h)
len -= n;
}
}
+ CloseSocket_upnphttp(h);
}
diff -urBp miniupnpd/upnpsoap.c miniupnpd.new/upnpsoap.c
--- miniupnpd/upnpsoap.c 2011-07-15 11:53:39.000000000 +0400
+++ miniupnpd.new/upnpsoap.c 2011-10-17 16:56:09.000000000 +0400
@@ -54,7 +54,6 @@ BuildSendAndCloseSoapResp(struct upnphtt
h->res_buflen += sizeof(afterbody) - 1;
SendResp_upnphttp(h);
- CloseSocket_upnphttp(h);
}
static void
@@ -1865,6 +1864,5 @@ SoapError(struct upnphttp * h, int errCo
bodylen = snprintf(body, sizeof(body), resp, errCode, errDesc);
BuildResp2_upnphttp(h, 500, "Internal Server Error", body, bodylen);
SendResp_upnphttp(h);
- CloseSocket_upnphttp(h);
}
@@ -0,0 +1,14 @@
Index: miniupnpd-1.6.20110730/netfilter/iptcrdr.c
===================================================================
--- miniupnpd-1.6.20110730.orig/netfilter/iptcrdr.c 2011-07-30 21:15:24.000000000 +0800
+++ miniupnpd-1.6.20110730/netfilter/iptcrdr.c 2019-06-17 15:02:20.427014672 +0800
@@ -625,7 +625,7 @@
struct ip_nat_range * range;
size_t size;
- size = IPT_ALIGN(sizeof(struct ipt_entry_target))
+ size = IPT_ALIGN(sizeof(struct ipt_standard_target))
+ IPT_ALIGN(sizeof(struct ip_nat_multi_range));
target = calloc(1, size);
target->u.target_size = size;
@@ -0,0 +1,54 @@
Index: miniupnpd-1.6.20110730/netfilter/iptcrdr.c
===================================================================
--- miniupnpd-1.6.20110730.orig/netfilter/iptcrdr.c 2020-12-22 17:04:37.100964000 +0800
+++ miniupnpd-1.6.20110730/netfilter/iptcrdr.c 2020-12-22 17:06:23.888428481 +0800
@@ -147,6 +147,29 @@
}
}
+/*update Description for Dal*/
+static void update_Description(){
+ struct rdr_desc * q;
+ FILE *dalfp = NULL;
+ char buf[128]={'\0'};
+ char tmpRule[4096]={'\0'};
+
+ dalfp = fopen("/tmp/miniupnpDescr", "r");
+ if(dalfp != NULL)
+ {
+ unlink("/tmp/miniupnpDescr");
+ fclose(dalfp);
+ }
+
+ dalfp = fopen("/tmp/miniupnpDescr", "w+");
+ for(q = rdr_desc_list; q; q = q->next)
+ {
+ //printf("166 %s %d %d\n",q->str,q->proto,q->eport);
+ fprintf(dalfp,"%s %d %d\n",q->str,q->proto,q->eport);
+ }
+ fclose(dalfp);
+}
+
/* go through the list to find the description */
static void
get_redirect_desc(unsigned short eport, int proto,
@@ -205,8 +228,10 @@
const char * desc, unsigned int timestamp)
{
int r = addnatrule(proto, eport, iaddr, iport, rhost);
- if(r >= 0)
+ if(r >= 0){
add_redirect_desc(eport, proto, desc, timestamp);
+ update_Description();
+ }
return r;
}
@@ -573,6 +598,7 @@
}
}
del_redirect_desc(eport, proto);
+ update_Description();
return r;
}
@@ -0,0 +1,31 @@
Index: miniupnpd-1.6.20110730/netfilter/iptcrdr.c
===================================================================
--- miniupnpd-1.6.20110730.orig/netfilter/iptcrdr.c 2020-12-29 16:53:36.954142127 +0800
+++ miniupnpd-1.6.20110730/netfilter/iptcrdr.c 2020-12-29 17:05:33.616868837 +0800
@@ -164,8 +164,8 @@
dalfp = fopen("/tmp/miniupnpDescr", "w+");
for(q = rdr_desc_list; q; q = q->next)
{
- //printf("166 %s %d %d\n",q->str,q->proto,q->eport);
- fprintf(dalfp,"%s %d %d\n",q->str,q->proto,q->eport);
+ //printf("167 %s %d %d\n",q->str,q->proto,q->eport);
+ fprintf(dalfp,"%d(zyxel)%d(zyxel)%s\n",q->proto,q->eport,q->str);
}
fclose(dalfp);
}
@@ -231,6 +231,7 @@
if(r >= 0){
add_redirect_desc(eport, proto, desc, timestamp);
update_Description();
+ //printf("%d %s\n", __LINE__, __func__);
}
return r;
}
@@ -599,6 +600,7 @@
}
del_redirect_desc(eport, proto);
update_Description();
+ //printf("%d %s\n", __LINE__, __func__);
return r;
}
@@ -0,0 +1,36 @@
Index: miniupnpd-1.6.20110730/upnpreplyparse.c
===================================================================
--- miniupnpd-1.6.20110730.orig/upnpreplyparse.c 2011-02-15 01:55:58.000000000 +0800
+++ miniupnpd-1.6.20110730/upnpreplyparse.c 2021-01-05 14:24:15.475828596 +0800
@@ -59,9 +59,10 @@
struct NameValueParserData * data)
{
struct xmlparser parser;
- LIST_INIT(&(data->head));
- data->portListing = NULL;
- data->portListingLength = 0;
+ memset(data, 0, sizeof(struct NameValueParserData));
+ //LIST_INIT(&(data->head));
+ //data->portListing = NULL;
+ //data->portListingLength = 0;
/* init xmlparser object */
parser.xmlstart = buffer;
parser.xmlsize = bufsize;
Index: miniupnpd-1.6.20110730/upnpsoap.c
===================================================================
--- miniupnpd-1.6.20110730.orig/upnpsoap.c 2021-01-05 14:20:44.090689890 +0800
+++ miniupnpd-1.6.20110730/upnpsoap.c 2021-01-05 14:24:18.731213605 +0800
@@ -1479,6 +1479,13 @@
rem_port = GetValueFromNameValueList(&data, "RemotePort");
protocol = GetValueFromNameValueList(&data, "Protocol");
+ if (!int_port || !rem_port || !protocol)
+ {
+ ClearNameValueList(&data);
+ SoapError(h, 402, "Invalid Args");
+ return;
+ }
+
rport = (unsigned short)atoi(rem_port);
iport = (unsigned short)atoi(int_port);
proto = atoi(protocol);