From 5c224accbfe130c2d8adfb3bc003230bcc02f948 Mon Sep 17 00:00:00 2001 From: Shawn Landen Date: Wed, 29 Feb 2012 17:44:38 -0800 Subject: [PATCH] remove trailing whitespace from miniupnpd --- miniupnpd/Changelog.txt | 14 ++-- miniupnpd/INSTALL | 6 +- miniupnpd/LICENSE | 2 +- miniupnpd/Makefile | 2 +- miniupnpd/Makefile.linux | 2 +- miniupnpd/bsd/getifstats.c | 2 +- miniupnpd/bsd/ifacewatcher.c | 2 +- miniupnpd/bsd/testgetifstats.c | 2 +- miniupnpd/bsdqueue.h | 12 ++-- miniupnpd/daemonize.c | 20 +++--- miniupnpd/daemonize.h | 4 +- miniupnpd/getconnstatus.c | 2 +- miniupnpd/getconnstatus.h | 2 +- miniupnpd/getifaddr.c | 2 +- miniupnpd/getifaddr.h | 2 +- miniupnpd/getifstats.h | 2 +- miniupnpd/ifacewatcher.h | 2 +- miniupnpd/ipf/ipfrdr.c | 8 +-- miniupnpd/ipf/ipfrdr.h | 4 +- miniupnpd/ipfw/ipfwaux.h | 14 ++-- miniupnpd/ipfw/ipfwrdr.c | 72 +++++++++---------- miniupnpd/ipfw/ipfwrdr.h | 28 ++++---- miniupnpd/linux/getifstats.c | 2 +- miniupnpd/linux/ifacewatcher.c | 2 +- miniupnpd/mac/getifstats.c | 4 +- miniupnpd/mac/testgetifstats.c | 2 +- miniupnpd/minissdp.c | 20 +++--- miniupnpd/miniupnpd.c | 36 +++++----- miniupnpd/minixml.c | 4 +- miniupnpd/natpmp.c | 8 +-- miniupnpd/netfilter/Makefile | 2 +- .../netfilter/iptables_init_and_clean.sh | 2 +- miniupnpd/netfilter/iptcrdr.c | 12 ++-- miniupnpd/netfilter/iptcrdr.h | 2 +- miniupnpd/netfilter/testiptcrdr.c | 4 +- miniupnpd/options.c | 10 +-- miniupnpd/options.h | 4 +- miniupnpd/pf/obsdrdr.c | 10 +-- miniupnpd/pf/obsdrdr.h | 4 +- miniupnpd/pf/testobsdrdr.c | 4 +- miniupnpd/solaris/getifstats.c | 2 +- miniupnpd/testgetifaddr.c | 2 +- miniupnpd/testgetifstats.c | 2 +- miniupnpd/testupnpdescgen.c | 2 +- miniupnpd/upnpdescgen.c | 28 ++++---- miniupnpd/upnpdescgen.h | 10 +-- miniupnpd/upnpevents.c | 2 +- miniupnpd/upnpglobalvars.c | 4 +- miniupnpd/upnpglobalvars.h | 2 +- miniupnpd/upnphttp.c | 10 +-- miniupnpd/upnphttp.h | 4 +- miniupnpd/upnppermissions.h | 4 +- miniupnpd/upnpredirect.c | 24 +++---- miniupnpd/upnpredirect.h | 10 +-- miniupnpd/upnpreplyparse.c | 6 +- miniupnpd/upnpreplyparse.h | 4 +- miniupnpd/upnpsoap.c | 66 ++++++++--------- miniupnpd/upnpsoap.h | 4 +- miniupnpd/upnpurns.h | 2 +- 59 files changed, 263 insertions(+), 263 deletions(-) diff --git a/miniupnpd/Changelog.txt b/miniupnpd/Changelog.txt index 3f4a581..16727f1 100644 --- a/miniupnpd/Changelog.txt +++ b/miniupnpd/Changelog.txt @@ -47,7 +47,7 @@ $Id: Changelog.txt,v 1.260 2012/02/15 22:44:26 nanard Exp $ 2011/11/18: avoid infinite loop in SendResp_upnphttp() in case of error - Replaced SendResp_upnphttp() + CloseSocket_upnphttp() by + Replaced SendResp_upnphttp() + CloseSocket_upnphttp() by SendRespAndClose_upnphttp() Tomato specifics in genconfig.sh @@ -284,7 +284,7 @@ VERSION 1.3 : work to support iptables-1.4.3 and up 2009/04/10: - fix in upnpevents_removeSubscriber() + fix in upnpevents_removeSubscriber() 2009/02/14: added reload_from_lease_file() @@ -296,7 +296,7 @@ VERSION 1.3 : 2009/01/29: Some minor changes to Makefile - improving Makefile.linux in order to build with iptables not properly + improving Makefile.linux in order to build with iptables not properly installed on the system. 2009/01/23: @@ -327,7 +327,7 @@ VERSION 1.2 : 2008/10/01: Improvements in genconfig.sh for detecting ipf or pf (under FreeBSD) and improve debian/ubuntu stuff. - custom chain name patch from : + custom chain name patch from : http://miniupnp.tuxfamily.org/forum/viewtopic.php?t=493 2008/08/24: @@ -375,7 +375,7 @@ VERSION 1.1 : fixed a small bug in the description 2008/03/03: - Fixed miniupnpd.c for compiling without natpmp support + Fixed miniupnpd.c for compiling without natpmp support fixed presentationURL not there with L3F fixing lease file creation/modification @@ -643,7 +643,7 @@ VERSION 1.0 : minixml updated. should have no impact Added support for presentationURL with -w switch implemented getifstats() for linux. Added testgetifstats program - improved error handling in getifstats() BSD + improved error handling in getifstats() BSD 2006/11/26: no need to have miniupnpc sources to compile miniupnpd. @@ -760,7 +760,7 @@ VERSION 1.0 : filtering SSDP requests and responding with same ST: field 2006/07/25: - Added a dummy description for the WANDevice + Added a dummy description for the WANDevice 2006/07/20: Command line arguments processing diff --git a/miniupnpd/INSTALL b/miniupnpd/INSTALL index b156209..ebb432d 100644 --- a/miniupnpd/INSTALL +++ b/miniupnpd/INSTALL @@ -25,7 +25,7 @@ To Build and Install : and "anchor miniupnpd" lines. - install as root using : # make install - or + or # PREFIX=/usr/local make install - run as root : The daemon needs rights to modify pf rules. @@ -66,7 +66,7 @@ To Build and install : > vi config.h - Build the daemon > make -f Makefile.linux - If not using iptables from your system, + If not using iptables from your system, > IPTABLESPATH=/path/to/iptables-1.4.1 make -f Makefile.linux note : make sure you have iptables with static libraries compiled. use "./configure --enable-static" before compiling iptables @@ -137,7 +137,7 @@ automatically. To stop the daemon use : # kill `cat /var/run/miniupnpd.pid` -or if your linux system use /etc/init.d/ +or if your linux system use /etc/init.d/ # /etc/init.d/miniupnpd stop diff --git a/miniupnpd/LICENSE b/miniupnpd/LICENSE index 140ea38..efaa9c6 100644 --- a/miniupnpd/LICENSE +++ b/miniupnpd/LICENSE @@ -1,5 +1,5 @@ MiniUPnPd -Copyright (c) 2006-2011, Thomas BERNARD +Copyright (c) 2006-2011, Thomas BERNARD All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/miniupnpd/Makefile b/miniupnpd/Makefile index 6eb4b94..8991699 100644 --- a/miniupnpd/Makefile +++ b/miniupnpd/Makefile @@ -192,4 +192,4 @@ config.h: genconfig.sh # $(CC) $(CFLAGS) -c -o $(.TARGET) $(.IMPSRC) - + diff --git a/miniupnpd/Makefile.linux b/miniupnpd/Makefile.linux index 10d55e7..765993a 100644 --- a/miniupnpd/Makefile.linux +++ b/miniupnpd/Makefile.linux @@ -18,7 +18,7 @@ # $ IPTABLESPATH=/path/to/iptables-1.4.1 make -f Makefile.linux # #CFLAGS = -Wall -O -D_GNU_SOURCE -g -DDEBUG -CFLAGS ?= -Wall -Os -D_GNU_SOURCE -fno-strict-aliasing -Wstrict-prototypes +CFLAGS ?= -Wall -Os -D_GNU_SOURCE -fno-strict-aliasing -Wstrict-prototypes CC ?= gcc RM = rm -f INSTALL = install diff --git a/miniupnpd/bsd/getifstats.c b/miniupnpd/bsd/getifstats.c index 780523e..0d37052 100644 --- a/miniupnpd/bsd/getifstats.c +++ b/miniupnpd/bsd/getifstats.c @@ -35,7 +35,7 @@ struct nlist list[] = { {NULL} }; -int +int getifstats(const char * ifname, struct ifdata * data) { #if defined(__FreeBSD__) || defined(__DragonFly__) diff --git a/miniupnpd/bsd/ifacewatcher.c b/miniupnpd/bsd/ifacewatcher.c index aa5af00..70b60bc 100644 --- a/miniupnpd/bsd/ifacewatcher.c +++ b/miniupnpd/bsd/ifacewatcher.c @@ -69,7 +69,7 @@ ProcessInterfaceWatchNotify(int s) } rtm = (struct rt_msghdr *)buf; syslog(LOG_DEBUG, "%u rt_msg : msglen=%d version=%d type=%d", (unsigned)len, - rtm->rtm_msglen, rtm->rtm_version, rtm->rtm_type); + rtm->rtm_msglen, rtm->rtm_version, rtm->rtm_type); switch(rtm->rtm_type) { case RTM_IFINFO: /* iface going up/down etc. */ ifm = (struct if_msghdr *)buf; diff --git a/miniupnpd/bsd/testgetifstats.c b/miniupnpd/bsd/testgetifstats.c index 6627252..4dff850 100644 --- a/miniupnpd/bsd/testgetifstats.c +++ b/miniupnpd/bsd/testgetifstats.c @@ -1,6 +1,6 @@ /* MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ - * (c) 2006 Thomas Bernard + * (c) 2006 Thomas Bernard * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ diff --git a/miniupnpd/bsdqueue.h b/miniupnpd/bsdqueue.h index 1fe0599..c6afe1f 100644 --- a/miniupnpd/bsdqueue.h +++ b/miniupnpd/bsdqueue.h @@ -36,7 +36,7 @@ #define _SYS_QUEUE_H_ /* - * This file defines five types of data structures: singly-linked lists, + * This file defines five types of data structures: singly-linked lists, * lists, simple queues, tail queues, and circular queues. * * @@ -95,7 +95,7 @@ struct name { \ struct type *slh_first; /* first element */ \ } - + #define SLIST_HEAD_INITIALIZER(head) \ { NULL } @@ -107,7 +107,7 @@ struct name { \ struct { \ struct type *sle_next; /* next element */ \ } - + /* * Singly-linked List access methods. */ @@ -322,8 +322,8 @@ struct { \ struct type **tqe_prev; /* address of previous next element */ \ } -/* - * tail queue access methods +/* + * tail queue access methods */ #define TAILQ_FIRST(head) ((head)->tqh_first) #define TAILQ_END(head) NULL @@ -430,7 +430,7 @@ struct { \ } /* - * Circular queue access methods + * Circular queue access methods */ #define CIRCLEQ_FIRST(head) ((head)->cqh_first) #define CIRCLEQ_LAST(head) ((head)->cqh_last) diff --git a/miniupnpd/daemonize.c b/miniupnpd/daemonize.c index 6fbc645..a490a9e 100644 --- a/miniupnpd/daemonize.c +++ b/miniupnpd/daemonize.c @@ -1,7 +1,7 @@ /* $Id: daemonize.c,v 1.12 2011/05/27 09:35:02 nanard Exp $ */ /* MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ - * (c) 2006 Thomas Bernard + * (c) 2006 Thomas Bernard * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ @@ -31,7 +31,7 @@ daemonize(void) case -1: perror("fork()"); exit(1); - + /* child process */ case 0: /* obtain a new process group */ @@ -42,14 +42,14 @@ daemonize(void) } /* close all descriptors */ - for (i=getdtablesize();i>=0;--i) close(i); + for (i=getdtablesize();i>=0;--i) close(i); i = open("/dev/null", O_RDWR); /* open stdin */ dup(i); /* stdout */ dup(i); /* stderr */ umask(027); - chdir("/"); /* chdir to /tmp ? */ + chdir("/"); /* chdir to /tmp ? */ return pid; @@ -69,7 +69,7 @@ writepidfile(const char * fname, int pid) if(!fname || (strlen(fname) == 0)) return -1; - + if( (pidfile = open(fname, O_WRONLY|O_CREAT, 0644)) < 0) { syslog(LOG_ERR, "Unable to open pidfile for writing %s: %m", fname); @@ -79,7 +79,7 @@ writepidfile(const char * fname, int pid) pidstringlen = snprintf(pidstring, sizeof(pidstring), "%d\n", pid); if(pidstringlen <= 0) { - syslog(LOG_ERR, + syslog(LOG_ERR, "Unable to write to pidfile %s: snprintf(): FAILED", fname); close(pidfile); return -1; @@ -107,9 +107,9 @@ checkforrunning(const char * fname) if( (pidfile = open(fname, O_RDONLY)) < 0) return 0; - + memset(buffer, 0, 64); - + if(read(pidfile, buffer, 63)) { if( (pid = atol(buffer)) > 0) @@ -121,9 +121,9 @@ checkforrunning(const char * fname) } } } - + close(pidfile); - + return 0; } diff --git a/miniupnpd/daemonize.h b/miniupnpd/daemonize.h index b2626d5..202ffb9 100644 --- a/miniupnpd/daemonize.h +++ b/miniupnpd/daemonize.h @@ -1,7 +1,7 @@ /* $Id: daemonize.h,v 1.6 2008/01/29 13:04:46 nanard Exp $ */ /* MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ - * (c) 2006 Thomas Bernard + * (c) 2006 Thomas Bernard * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ @@ -12,7 +12,7 @@ #ifndef USE_DAEMON /* daemonize() - * "fork" to background, detach from terminal, etc... + * "fork" to background, detach from terminal, etc... * returns: pid of the daemon, exits upon failure */ int daemonize(void); diff --git a/miniupnpd/getconnstatus.c b/miniupnpd/getconnstatus.c index 963a671..2b36e80 100644 --- a/miniupnpd/getconnstatus.c +++ b/miniupnpd/getconnstatus.c @@ -1,7 +1,7 @@ /* $Id: getconnstatus.c,v 1.4 2011/05/23 20:22:41 nanard Exp $ */ /* MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ - * (c) 2011 Thomas Bernard + * (c) 2011 Thomas Bernard * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ diff --git a/miniupnpd/getconnstatus.h b/miniupnpd/getconnstatus.h index eed7644..215913a 100644 --- a/miniupnpd/getconnstatus.h +++ b/miniupnpd/getconnstatus.h @@ -1,7 +1,7 @@ /* $Id: getconnstatus.h,v 1.2 2011/05/23 20:22:41 nanard Exp $ */ /* MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ - * (c) 2011 Thomas Bernard + * (c) 2011 Thomas Bernard * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ diff --git a/miniupnpd/getifaddr.c b/miniupnpd/getifaddr.c index 78d4fd6..c86034d 100644 --- a/miniupnpd/getifaddr.c +++ b/miniupnpd/getifaddr.c @@ -1,7 +1,7 @@ /* $Id: getifaddr.c,v 1.14 2012/02/07 11:05:07 nanard Exp $ */ /* MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ - * (c) 2006-2011 Thomas Bernard + * (c) 2006-2011 Thomas Bernard * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ diff --git a/miniupnpd/getifaddr.h b/miniupnpd/getifaddr.h index 8b5404f..ccc6f64 100644 --- a/miniupnpd/getifaddr.h +++ b/miniupnpd/getifaddr.h @@ -1,7 +1,7 @@ /* $Id: getifaddr.h,v 1.5 2011/05/15 08:59:27 nanard Exp $ */ /* MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ - * (c) 2006-2011 Thomas Bernard + * (c) 2006-2011 Thomas Bernard * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ diff --git a/miniupnpd/getifstats.h b/miniupnpd/getifstats.h index a18e627..2ffcb34 100644 --- a/miniupnpd/getifstats.h +++ b/miniupnpd/getifstats.h @@ -1,6 +1,6 @@ /* MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ - * (c) 2006-2008 Thomas Bernard + * (c) 2006-2008 Thomas Bernard * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ diff --git a/miniupnpd/ifacewatcher.h b/miniupnpd/ifacewatcher.h index 88447a3..ffbf867 100644 --- a/miniupnpd/ifacewatcher.h +++ b/miniupnpd/ifacewatcher.h @@ -9,7 +9,7 @@ * which weren't available during daemon start. It also takes care * of interfaces which become unavailable. * - * Copyright (c) 2011, Alexey Osipov + * Copyright (c) 2011, Alexey Osipov * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/miniupnpd/ipf/ipfrdr.c b/miniupnpd/ipf/ipfrdr.c index 43a1749..309c862 100644 --- a/miniupnpd/ipf/ipfrdr.c +++ b/miniupnpd/ipf/ipfrdr.c @@ -142,7 +142,7 @@ add_redirect_desc(unsigned short eport, int proto, const char * desc) { struct rdr_desc * p; size_t l; - + if (desc != NULL) { l = strlen(desc) + 1; p = malloc(sizeof(struct rdr_desc) + l); @@ -178,7 +178,7 @@ static void get_redirect_desc(unsigned short eport, int proto, char * desc, int desclen) { struct rdr_desc * p; - + if (desc == NULL || desclen == 0) return; for (p = rdr_desc_list; p; p = p->next) { @@ -192,7 +192,7 @@ get_redirect_desc(unsigned short eport, int proto, char * desc, int desclen) int init_redirect(void) { - + dev = open(IPNAT_NAME, O_RDWR); if (dev < 0) { syslog(LOG_ERR, "open(\"%s\"): %m", IPNAT_NAME); @@ -208,7 +208,7 @@ int init_redirect(void) void shutdown_redirect(void) { - + if (dev >= 0) { close(dev); dev = -1; diff --git a/miniupnpd/ipf/ipfrdr.h b/miniupnpd/ipf/ipfrdr.h index f10ed61..f0e5804 100644 --- a/miniupnpd/ipf/ipfrdr.h +++ b/miniupnpd/ipf/ipfrdr.h @@ -1,7 +1,7 @@ /* $Id: ipfrdr.h,v 1.3 2007/11/02 22:54:01 nanard Exp $ */ /* MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ - * (c) 2006-2007 Thomas Bernard + * (c) 2006-2007 Thomas Bernard * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ #ifndef __IPFRDR_H__ @@ -18,7 +18,7 @@ int add_filter_rule2(const char * ifname, const char * iaddr, unsigned short eport, unsigned short iport, int proto, const char * desc); - + /* get_redirect_rule() gets internal IP and port from * interface, external port and protocl diff --git a/miniupnpd/ipfw/ipfwaux.h b/miniupnpd/ipfw/ipfwaux.h index 241567f..4f3be7d 100644 --- a/miniupnpd/ipfw/ipfwaux.h +++ b/miniupnpd/ipfw/ipfwaux.h @@ -21,7 +21,7 @@ static int ipfw_exec(int optname, void * optval, uintptr_t optlen) { static int sock = -1; int result; - + switch (optname) { case IP_FW_INIT: if (sock == -1) @@ -48,14 +48,14 @@ static int ipfw_exec(int optname, void * optval, uintptr_t optlen) { result = getsockopt(sock, IPPROTO_IP, optname, optval, (socklen_t *)optlen); if (result == -1) { syslog(LOG_ERR, "getsockopt(): %m"); - return -1; + return -1; } break; default: syslog(LOG_ERR, "unhandled option"); return -1; } - + return 0; } @@ -69,23 +69,23 @@ static void ipfw_free_ruleset(struct ip_fw ** rules) { static int ipfw_fetch_ruleset(struct ip_fw ** rules, int * total_fetched, int count) { int fetched; socklen_t size; - + if (rules == NULL || *total_fetched < 0 || count < 1) return -1; - + size = sizeof(struct ip_fw) * (*total_fetched + count); *rules = (struct ip_fw *)realloc(*rules, size); if (*rules == NULL) { syslog(LOG_ERR, "realloc(): %m"); return -1; } - + (*rules)->version = IP_FW_CURRENT_API_VERSION; if (ipfw_exec(IP_FW_GET, *rules, (uintptr_t)&size) < 0) return -1; fetched = *total_fetched; *total_fetched = size / sizeof(struct ip_fw); - + return *total_fetched - fetched; } diff --git a/miniupnpd/ipfw/ipfwrdr.c b/miniupnpd/ipfw/ipfwrdr.c index 26beb19..c2d3e9e 100644 --- a/miniupnpd/ipfw/ipfwrdr.c +++ b/miniupnpd/ipfw/ipfwrdr.c @@ -170,7 +170,7 @@ int add_redirect_rule2( return -1; if (ipfw_validate_ifname(ifname) < 0) return -1; - + memset(&rule, 0, sizeof(struct ip_fw)); rule.version = IP_FW_CURRENT_API_VERSION; #if 0 @@ -191,7 +191,7 @@ int add_redirect_rule2( if (inet_aton(iaddr, &rule.fw_out_if.fu_via_ip) == 0) { syslog(LOG_ERR, "inet_aton(): %m"); return -1; - } + } memcpy(&rule.fw_dst, &rule.fw_out_if.fu_via_ip, sizeof(struct in_addr)); memcpy(&rule.fw_fwd_ip.sin_addr, &rule.fw_out_if.fu_via_ip, sizeof(struct in_addr)); rule.fw_dmsk.s_addr = INADDR_BROADCAST; /* TODO check this */ @@ -216,10 +216,10 @@ int get_redirect_rule( const char * ifname, unsigned short eport, int proto, - char * iaddr, - int iaddrlen, + char * iaddr, + int iaddrlen, unsigned short * iport, - char * desc, + char * desc, int desclen, char * rhost, int rhostlen, @@ -229,7 +229,7 @@ int get_redirect_rule( { int i, count_rules, total_rules = 0; struct ip_fw * rules = NULL; - + if (ipfw_validate_protocol(proto) < 0) return -1; if (ipfw_validate_ifname(ifname) < 0) @@ -242,7 +242,7 @@ int get_redirect_rule( if (count_rules < 0) goto error; } while (count_rules == 10); - + for (i=0; ifw_prot && eport == ptr->fw_uar.fw_pts[0]) { @@ -258,7 +258,7 @@ int get_redirect_rule( if (inet_ntop(AF_INET, &ptr->fw_fwd_ip.sin_addr, iaddr, iaddrlen) == NULL) { syslog(LOG_ERR, "inet_ntop(): %m"); goto error; - } + } } if (rhost != NULL && rhostlen > 0) { if (ptr->fw_src.s_addr == 0) @@ -266,7 +266,7 @@ int get_redirect_rule( else if (inet_ntop(AF_INET, &ptr->fw_src.s_addr, rhost, rhostlen) == NULL) { syslog(LOG_ERR, "inet_ntop(): %m"); goto error; - } + } } /* And what if we found more than 1 matching rule? */ ipfw_free_ruleset(&rules); @@ -277,29 +277,29 @@ int get_redirect_rule( error: if (rules != NULL) - ipfw_free_ruleset(&rules); + ipfw_free_ruleset(&rules); return -1; } int delete_redirect_rule( const char * ifname, unsigned short eport, - int proto) + int proto) { int i, count_rules, total_rules = 0; struct ip_fw * rules = NULL; - + if (ipfw_validate_protocol(proto) < 0) return -1; if (ipfw_validate_ifname(ifname) < 0) return -1; - + do { count_rules = ipfw_fetch_ruleset(&rules, &total_rules, 10); if (count_rules < 0) goto error; } while (count_rules == 10); - + for (i=0; ifw_prot && eport == ptr->fw_uar.fw_pts[0]) { @@ -311,47 +311,47 @@ int delete_redirect_rule( return 0; } } - + error: if (rules != NULL) - ipfw_free_ruleset(&rules); + ipfw_free_ruleset(&rules); return -1; } int add_filter_rule2( - const char * ifname, + const char * ifname, const char * rhost, const char * iaddr, - unsigned short eport, + unsigned short eport, unsigned short iport, - int proto, + int proto, const char * desc) { return 0; /* nothing to do, always success */ } int delete_filter_rule( - const char * ifname, - unsigned short eport, - int proto) + const char * ifname, + unsigned short eport, + int proto) { return 0; /* nothing to do, always success */ } int get_redirect_rule_by_index( int index, - char * ifname, + char * ifname, unsigned short * eport, - char * iaddr, - int iaddrlen, + char * iaddr, + int iaddrlen, unsigned short * iport, - int * proto, - char * desc, + int * proto, + char * desc, int desclen, char * rhost, int rhostlen, unsigned int * timestamp, - u_int64_t * packets, + u_int64_t * packets, u_int64_t * bytes) { int total_rules = 0; @@ -389,7 +389,7 @@ int get_redirect_rule_by_index( if (inet_ntop(AF_INET, &ptr->fw_fwd_ip.sin_addr, iaddr, iaddrlen) == NULL) { syslog(LOG_ERR, "inet_ntop(): %m"); goto error; - } + } } if (rhost != NULL && rhostlen > 0) { if (ptr->fw_src.s_addr == 0) @@ -397,7 +397,7 @@ int get_redirect_rule_by_index( else if (inet_ntop(AF_INET, &ptr->fw_src.s_addr, rhost, rhostlen) == NULL) { syslog(LOG_ERR, "inet_ntop(): %m"); goto error; - } + } } ipfw_free_ruleset(&rules); get_desc_time(*eport, *proto, desc, desclen, timestamp); @@ -406,8 +406,8 @@ int get_redirect_rule_by_index( error: if (rules != NULL) - ipfw_free_ruleset(&rules); - return -1; + ipfw_free_ruleset(&rules); + return -1; } /* upnp_get_portmappings_in_range() @@ -423,16 +423,16 @@ get_portmappings_in_range(unsigned short startport, unsigned int capacity = 128; int i, count_rules, total_rules = 0; struct ip_fw * rules = NULL; - + if (ipfw_validate_protocol(proto) < 0) return NULL; - + do { count_rules = ipfw_fetch_ruleset(&rules, &total_rules, 10); if (count_rules < 0) goto error; } while (count_rules == 10); - + array = calloc(capacity, sizeof(unsigned short)); if(!array) { syslog(LOG_ERR, "get_portmappings_in_range() : calloc error"); @@ -461,7 +461,7 @@ get_portmappings_in_range(unsigned short startport, } error: if (rules != NULL) - ipfw_free_ruleset(&rules); + ipfw_free_ruleset(&rules); return array; } diff --git a/miniupnpd/ipfw/ipfwrdr.h b/miniupnpd/ipfw/ipfwrdr.h index 0783de0..20fc471 100644 --- a/miniupnpd/ipfw/ipfwrdr.h +++ b/miniupnpd/ipfw/ipfwrdr.h @@ -2,7 +2,7 @@ /* * MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ - * (c) 2009 Jardel Weyrich + * (c) 2009 Jardel Weyrich * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ @@ -23,12 +23,12 @@ int add_redirect_rule2( unsigned int timestamp); int add_filter_rule2( - const char * ifname, - const char * rhost, + const char * ifname, + const char * rhost, const char * iaddr, - unsigned short eport, + unsigned short eport, unsigned short iport, - int proto, + int proto, const char * desc); #if 0 @@ -41,25 +41,25 @@ int get_redirect_rule( const char * ifname, unsigned short eport, int proto, - char * iaddr, - int iaddrlen, + char * iaddr, + int iaddrlen, unsigned short * iport, - char * desc, + char * desc, int desclen, u_int64_t * packets, u_int64_t * bytes); int get_redirect_rule_by_index( int index, - char * ifname, + char * ifname, unsigned short * eport, - char * iaddr, - int iaddrlen, + char * iaddr, + int iaddrlen, unsigned short * iport, - int * proto, - char * desc, + int * proto, + char * desc, int desclen, - u_int64_t * packets, + u_int64_t * packets, u_int64_t * bytes); #endif diff --git a/miniupnpd/linux/getifstats.c b/miniupnpd/linux/getifstats.c index 636bdd7..edb1ecd 100644 --- a/miniupnpd/linux/getifstats.c +++ b/miniupnpd/linux/getifstats.c @@ -1,7 +1,7 @@ /* $Id: getifstats.c,v 1.9 2011/05/25 22:22:57 nanard Exp $ */ /* MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ - * (c) 2006-2011 Thomas Bernard + * (c) 2006-2011 Thomas Bernard * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ diff --git a/miniupnpd/linux/ifacewatcher.c b/miniupnpd/linux/ifacewatcher.c index a82541a..6af2101 100644 --- a/miniupnpd/linux/ifacewatcher.c +++ b/miniupnpd/linux/ifacewatcher.c @@ -9,7 +9,7 @@ * which weren't available during daemon start. It also takes care * of interfaces which become unavailable. * - * Copyright (c) 2011, Alexey Osipov + * Copyright (c) 2011, Alexey Osipov * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/miniupnpd/mac/getifstats.c b/miniupnpd/mac/getifstats.c index d38774f..058d956 100644 --- a/miniupnpd/mac/getifstats.c +++ b/miniupnpd/mac/getifstats.c @@ -28,7 +28,7 @@ int getifstats(const char * ifname, struct ifdata * data) { size_t needed; char *buf, *end, *p; struct if_msghdr *ifm; - struct if_data ifdata; + struct if_data ifdata; #ifdef ENABLE_GETIFSTATS_CACHING static time_t cache_timestamp = 0; static struct ifdata cache_data; @@ -86,7 +86,7 @@ int getifstats(const char * ifname, struct ifdata * data) { #endif return 0; /* found, ok */ } - } + } } free(buf); return -1; /* not found or error */ diff --git a/miniupnpd/mac/testgetifstats.c b/miniupnpd/mac/testgetifstats.c index 6ed228b..8e23f95 100644 --- a/miniupnpd/mac/testgetifstats.c +++ b/miniupnpd/mac/testgetifstats.c @@ -2,7 +2,7 @@ /* * MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ - * (c) 2009 Jardel Weyrich + * (c) 2009 Jardel Weyrich * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ diff --git a/miniupnpd/minissdp.c b/miniupnpd/minissdp.c index 5adc974..85177a1 100644 --- a/miniupnpd/minissdp.c +++ b/miniupnpd/minissdp.c @@ -42,7 +42,7 @@ AddMulticastMembership(int s, in_addr_t ifaddr) imr.imr_multiaddr.s_addr = inet_addr(SSDP_MCAST_ADDR); /*imr.imr_interface.s_addr = htonl(INADDR_ANY);*/ imr.imr_interface.s_addr = ifaddr; /*inet_addr(ifaddr);*/ - + if (setsockopt(s, IPPROTO_IP, IP_ADD_MEMBERSHIP, (void *)&imr, sizeof(struct ip_mreq)) < 0) { syslog(LOG_ERR, "setsockopt(udp, IP_ADD_MEMBERSHIP): %m"); @@ -84,7 +84,7 @@ AddMulticastMembershipIPv6(int s) } #endif -/* Open and configure the socket listening for +/* Open and configure the socket listening for * SSDP udp packets sent on 239.255.255.250 port 1900 * SSDP v6 udp packets sent on FF02::C, or FF05::C, port 1900 */ int @@ -153,7 +153,7 @@ OpenAndConfSSDPReceiveSocket(int ipv6) if(AddMulticastMembership(s, lan_addr->addr.s_addr) < 0) { syslog(LOG_WARNING, - "Failed to add multicast membership for interface %s", + "Failed to add multicast membership for interface %s", lan_addr->str); } } @@ -172,7 +172,7 @@ OpenAndConfSSDPNotifySocket(in_addr_t addr) int bcast = 1; struct in_addr mc_if; struct sockaddr_in sockname; - + if( (s = socket(PF_INET, SOCK_DGRAM, 0)) < 0) { syslog(LOG_ERR, "socket(udp_notify): %m"); @@ -194,7 +194,7 @@ OpenAndConfSSDPNotifySocket(in_addr_t addr) close(s); return -1; } - + if(setsockopt(s, SOL_SOCKET, SO_BROADCAST, &bcast, sizeof(bcast)) < 0) { syslog(LOG_ERR, "setsockopt(udp_notify, SO_BROADCAST): %m"); @@ -272,12 +272,12 @@ SendSSDPAnnounce2(int s, const struct sockaddr * addr, char buf[512]; char addr_str[64]; socklen_t addrlen; - /* + /* * follow guideline from document "UPnP Device Architecture 1.0" * uppercase is recommended. * DATE: is recommended * SERVER: OS/ver UPnP/1.0 miniupnpd/1.0 - * - check what to put in the 'Cache-Control' header + * - check what to put in the 'Cache-Control' header * * have a look at the document "UPnP Device Architecture v1.1 */ l = snprintf(buf, sizeof(buf), "HTTP/1.1 200 OK\r\n" @@ -345,7 +345,7 @@ SendSSDPNotifies(int s, const char * host, unsigned short port, while(known_service_types[i]) { - l = snprintf(bufr, sizeof(bufr), + l = snprintf(bufr, sizeof(bufr), "NOTIFY * HTTP/1.1\r\n" "HOST: %s:%d\r\n" "CACHE-CONTROL: max-age=%u\r\n" @@ -547,7 +547,7 @@ ProcessSSDPData(int s, const char *bufr, int n, } } -/* This will broadcast ssdp:byebye notifications to inform +/* This will broadcast ssdp:byebye notifications to inform * the network that UPnP is going down. */ int SendSSDPGoodbye(int * sockets, int n_sockets) @@ -629,7 +629,7 @@ SubmitServicesToMiniSSDPD(const char * host, unsigned short port) { if(i > 0) p[l-1] = '1'; p += l; - l = snprintf(strbuf, sizeof(strbuf), "%s::%s%s", + l = snprintf(strbuf, sizeof(strbuf), "%s::%s%s", uuidvalue, known_service_types[i], (i==0)?"":"1"); CODELENGTH(l, p); memcpy(p, strbuf, l); diff --git a/miniupnpd/miniupnpd.c b/miniupnpd/miniupnpd.c index cd0b223..62dccc5 100644 --- a/miniupnpd/miniupnpd.c +++ b/miniupnpd/miniupnpd.c @@ -263,13 +263,13 @@ static int nfqueue_cb( int dport = get_udp_dst_port(pkt); int x = sizeof (struct ip) + sizeof (struct udphdr); - - /* packets we are interested in are UDP multicast to 239.255.255.250:1900 + + /* packets we are interested in are UDP multicast to 239.255.255.250:1900 * and start with a data string M-SEARCH */ - if ( (dport == 1900) && (id_protocol == IPPROTO_UDP) + if ( (dport == 1900) && (id_protocol == IPPROTO_UDP) && (ssdp.sin_addr.s_addr == iph->ip_dst.s_addr) ) { - + /* get the index that the packet came in on */ u_int32_t idx = nfq_get_indev(nfa); int i = 0; @@ -279,7 +279,7 @@ static int nfqueue_cb( struct udphdr *udp = (struct udphdr *) (pkt + sizeof(struct ip)); char *dd = pkt + x; - + struct sockaddr_in sendername; sendername.sin_family = AF_INET; sendername.sin_port = udp->source; @@ -291,7 +291,7 @@ static int nfqueue_cb( } } } - + nfq_set_verdict(qh, id, NF_ACCEPT, 0, NULL); } else { @@ -411,7 +411,7 @@ write_command_line(int fd, int argc, char * * argv) #endif -/* Handler for the SIGTERM signal (kill) +/* Handler for the SIGTERM signal (kill) * SIGINT is also handled */ static void sigterm(int sig) @@ -519,7 +519,7 @@ struct runtime_vars { * external interface associated with the lan subnet follows. * ex : 192.168.1.1/24 81.21.41.11 * - * return value : + * return value : * 0 : ok * -1 : error */ static int @@ -721,7 +721,7 @@ init(int argc, char * * argv, struct runtime_vars * v) case UPNPSERIAL: strncpy(serialnumber, ary_options[i].value, SERIALNUMBER_MAX_LEN); serialnumber[SERIALNUMBER_MAX_LEN-1] = '\0'; - break; + break; case UPNPMODEL_NUMBER: strncpy(modelnumber, ary_options[i].value, MODELNUMBER_MAX_LEN); modelnumber[MODELNUMBER_MAX_LEN-1] = '\0'; @@ -990,7 +990,7 @@ init(int argc, char * * argv, struct runtime_vars * v) { syslog(LOG_ERR, "MiniUPnPd is already running. EXITING"); return 1; - } + } set_startup_time(GETFLAG(SYSUPTIMEMASK)); @@ -1275,7 +1275,7 @@ main(int argc, char * * argv) if((startup_time<60*60*24) && (time(NULL)>60*60*24)) { set_startup_time(GETFLAG(SYSUPTIMEMASK)); - } + } /* send public address change notifications if needed */ if(should_send_public_address_change_notif) { @@ -1387,7 +1387,7 @@ main(int argc, char * * argv) FD_ZERO(&readset); FD_ZERO(&writeset); - if (sudp >= 0) + if (sudp >= 0) { FD_SET(sudp, &readset); max_fd = MAX( max_fd, sudp); @@ -1399,7 +1399,7 @@ main(int argc, char * * argv) } #endif } - if (shttpl >= 0) + if (shttpl >= 0) { FD_SET(shttpl, &readset); max_fd = MAX( max_fd, shttpl); @@ -1413,7 +1413,7 @@ main(int argc, char * * argv) #endif #ifdef ENABLE_NFQUEUE - if (nfqh >= 0) + if (nfqh >= 0) { FD_SET(nfqh, &readset); max_fd = MAX( max_fd, nfqh); @@ -1455,7 +1455,7 @@ main(int argc, char * * argv) FD_SET(sctl, &readset); max_fd = MAX( max_fd, sctl); } - + for(ectl = ctllisthead.lh_first; ectl; ectl = ectl->entries.le_next) { if(ectl->socket >= 0) { @@ -1699,7 +1699,7 @@ shutdown: } } #endif - + /*if(SendSSDPGoodbye(snotify, v.n_lan_addr) < 0)*/ if (GETFLAG(ENABLEUPNPMASK)) { @@ -1728,9 +1728,9 @@ shutdown: free(snatpmp); #endif free(snotify); - closelog(); + closelog(); freeoptions(); - + return 0; } diff --git a/miniupnpd/minixml.c b/miniupnpd/minixml.c index 8b5594c..d3f7d06 100644 --- a/miniupnpd/minixml.c +++ b/miniupnpd/minixml.c @@ -4,7 +4,7 @@ * webpage: http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ * Author : Thomas Bernard -Copyright (c) 2005-2011, Thomas BERNARD +Copyright (c) 2005-2011, Thomas BERNARD All rights reserved. Redistribution and use in source and binary forms, with or without @@ -149,7 +149,7 @@ static void parseelt(struct xmlparser * p) return; } if(memcmp(p->xml, "xml += 9; data = p->xml; diff --git a/miniupnpd/natpmp.c b/miniupnpd/natpmp.c index b9cad59..6150323 100644 --- a/miniupnpd/natpmp.c +++ b/miniupnpd/natpmp.c @@ -216,7 +216,7 @@ void ProcessIncomingNATPMPPacket(int s) } } else { /* To improve the interworking between nat-pmp and - * UPnP, we should check that we remove only NAT-PMP + * UPnP, we should check that we remove only NAT-PMP * mappings */ r = _upnp_delete_redir(eport, proto); /*syslog(LOG_DEBUG, "%hu %d r=%d", eport, proto, r);*/ @@ -344,7 +344,7 @@ int CleanExpiredNATPMP() return ScanNATPMPforExpiration(); /* check desc - this is important since we keep expiration time as part * of the desc. - * If the rule is renewed, timestamp and nextnatpmptoclean_timestamp + * If the rule is renewed, timestamp and nextnatpmptoclean_timestamp * can be different. In that case, the rule must not be removed ! */ if(sscanf(desc, "NAT-PMP %u", ×tamp) == 1) { if(timestamp > nextnatpmptoclean_timestamp) @@ -407,7 +407,7 @@ void SendNATPMPPublicAddressChangeNotification(int * sockets, int n_sockets) n = sendto(sockets[j], notif, 12, 0, (struct sockaddr *)&sockname, sizeof(struct sockaddr_in)); if(n < 0) - { + { syslog(LOG_ERR, "%s: sendto(s_udp=%d): %m", "SendNATPMPPublicAddressChangeNotification", sockets[j]); return; @@ -417,7 +417,7 @@ void SendNATPMPPublicAddressChangeNotification(int * sockets, int n_sockets) n = sendto(sockets[j], notif, 12, 0, (struct sockaddr *)&sockname, sizeof(struct sockaddr_in)); if(n < 0) - { + { syslog(LOG_ERR, "%s: sendto(s_udp=%d): %m", "SendNATPMPPublicAddressChangeNotification", sockets[j]); return; diff --git a/miniupnpd/netfilter/Makefile b/miniupnpd/netfilter/Makefile index 385a342..de7d56c 100644 --- a/miniupnpd/netfilter/Makefile +++ b/miniupnpd/netfilter/Makefile @@ -34,7 +34,7 @@ TEST_LIB := $(shell test -f /usr/lib$(ARCH)/libiptc.a && echo 1) ifeq ($(TEST_LIB), 1) LIBS = -liptc /usr/lib$(ARCH)/libiptc.a endif -endif +endif endif all: iptcrdr.o testiptcrdr diff --git a/miniupnpd/netfilter/iptables_init_and_clean.sh b/miniupnpd/netfilter/iptables_init_and_clean.sh index 0b1ab47..16f27d6 100755 --- a/miniupnpd/netfilter/iptables_init_and_clean.sh +++ b/miniupnpd/netfilter/iptables_init_and_clean.sh @@ -33,5 +33,5 @@ else echo "Filter table clean..initalizing.." $IPTABLES -t filter -N MINIUPNPD $IPTABLES -t filter -I FORWARD 4 -i $EXTIF ! -o $EXTIF -j MINIUPNPD -fi +fi diff --git a/miniupnpd/netfilter/iptcrdr.c b/miniupnpd/netfilter/iptcrdr.c index f256fc2..6807707 100644 --- a/miniupnpd/netfilter/iptcrdr.c +++ b/miniupnpd/netfilter/iptcrdr.c @@ -219,7 +219,7 @@ add_filter_rule2(const char * ifname, return add_filter_rule(proto, rhost, iaddr, iport); } -/* get_redirect_rule() +/* get_redirect_rule() * returns -1 if the rule is not found */ int get_redirect_rule(const char * ifname, unsigned short eport, int proto, @@ -305,7 +305,7 @@ get_redirect_rule(const char * ifname, unsigned short eport, int proto, return r; } -/* get_redirect_rule_by_index() +/* get_redirect_rule_by_index() * return -1 when the rule was not found */ int get_redirect_rule_by_index(int index, @@ -577,7 +577,7 @@ delete_redirect_and_filter_rules(unsigned short eport, int proto) } /* ==================================== */ -/* TODO : add the -m state --state NEW,ESTABLISHED,RELATED +/* TODO : add the -m state --state NEW,ESTABLISHED,RELATED * only for the filter rule */ static struct ipt_entry_match * get_tcp_match(unsigned short dport) @@ -711,7 +711,7 @@ iptc_init_verify_and_append(const char * table, return 0; } -/* add nat rule +/* add nat rule * iptables -t nat -A MINIUPNPD -p proto --dport eport -j DNAT --to iaddr:iport * */ static int @@ -753,7 +753,7 @@ addnatrule(int proto, unsigned short eport, e->ip.src.s_addr = inet_addr(rhost); e->ip.smsk.s_addr = INADDR_NONE; } - + r = iptc_init_verify_and_append("nat", miniupnpd_nat_chain, e, "addnatrule()"); free(target); free(match); @@ -816,7 +816,7 @@ add_filter_rule(int proto, const char * rhost, e->ip.src.s_addr = inet_addr(rhost); e->ip.smsk.s_addr = INADDR_NONE; } - + r = iptc_init_verify_and_append("filter", miniupnpd_forward_chain, e, "add_filter_rule()"); free(target); free(match); diff --git a/miniupnpd/netfilter/iptcrdr.h b/miniupnpd/netfilter/iptcrdr.h index 2f35c61..5225426 100644 --- a/miniupnpd/netfilter/iptcrdr.h +++ b/miniupnpd/netfilter/iptcrdr.h @@ -1,7 +1,7 @@ /* $Id: iptcrdr.h,v 1.17 2011/06/04 15:44:58 nanard Exp $ */ /* MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ - * (c) 2006-2011 Thomas Bernard + * (c) 2006-2011 Thomas Bernard * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ diff --git a/miniupnpd/netfilter/testiptcrdr.c b/miniupnpd/netfilter/testiptcrdr.c index 79fb61a..7fa697f 100644 --- a/miniupnpd/netfilter/testiptcrdr.c +++ b/miniupnpd/netfilter/testiptcrdr.c @@ -1,7 +1,7 @@ /* $Id: testiptcrdr.c,v 1.16 2011/03/02 16:04:23 nanard Exp $ */ /* MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ - * (c) 2006-2011 Thomas Bernard + * (c) 2006-2011 Thomas Bernard * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ @@ -22,7 +22,7 @@ main(int argc, char ** argv) unsigned short eport, iport; const char * iaddr; printf("Usage %s \n", argv[0]); - + if(argc<4) return -1; openlog("testiptcrdr", LOG_PERROR|LOG_CONS, LOG_LOCAL0); diff --git a/miniupnpd/options.c b/miniupnpd/options.c index ce3cfe2..dc521c2 100644 --- a/miniupnpd/options.c +++ b/miniupnpd/options.c @@ -2,7 +2,7 @@ /* MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ * author: Ryan Wagoner - * (c) 2006-2012 Thomas Bernard + * (c) 2006-2012 Thomas Bernard * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ @@ -99,7 +99,7 @@ readoptionsfile(const char * fname) while(fgets(buffer, sizeof(buffer), hfile)) { linenum++; - t = strchr(buffer, '\n'); + t = strchr(buffer, '\n'); if(t) { *t = '\0'; @@ -111,7 +111,7 @@ readoptionsfile(const char * fname) t--; } } - + /* skip leading whitespaces */ name = buffer; while(isspace(*name)) @@ -214,7 +214,7 @@ readoptionsfile(const char * fname) } } - + fclose(hfile); for(i = 0; i < num_options; i++) @@ -222,7 +222,7 @@ readoptionsfile(const char * fname) /* add start address of string_repo to get right pointer */ ary_options[i].value = string_repo + (size_t)ary_options[i].value; } - + return 0; } diff --git a/miniupnpd/options.h b/miniupnpd/options.h index c42ec75..caa19e5 100644 --- a/miniupnpd/options.h +++ b/miniupnpd/options.h @@ -2,7 +2,7 @@ /* MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ * author: Ryan Wagoner - * (c) 2006-2012 Thomas Bernard + * (c) 2006-2012 Thomas Bernard * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ @@ -57,7 +57,7 @@ enum upnpconfigoptions { int readoptionsfile(const char * fname); -/* freeoptions() +/* freeoptions() * frees memory allocated to option values */ void freeoptions(void); diff --git a/miniupnpd/pf/obsdrdr.c b/miniupnpd/pf/obsdrdr.c index 65c1c50..ef3ed90 100644 --- a/miniupnpd/pf/obsdrdr.c +++ b/miniupnpd/pf/obsdrdr.c @@ -1,7 +1,7 @@ /* $Id: obsdrdr.c,v 1.69 2012/02/03 11:59:16 nanard Exp $ */ /* MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ - * (c) 2006-2010 Thomas Bernard + * (c) 2006-2010 Thomas Bernard * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ @@ -217,7 +217,7 @@ add_redirect_rule2(const char * ifname, pcr.rule.nat.addr.type = PF_ADDR_NONE; pcr.rule.rdr.addr.type = PF_ADDR_ADDRMASK; #endif - + pcr.rule.dst.port_op = PF_OP_EQ; pcr.rule.dst.port[0] = htons(eport); pcr.rule.dst.port[1] = htons(eport); @@ -358,7 +358,7 @@ add_filter_rule2(const char * ifname, if(1) { #endif - + pcr.rule.dst.port_op = PF_OP_EQ; pcr.rule.dst.port[0] = htons(eport); pcr.rule.direction = PF_IN; @@ -376,7 +376,7 @@ add_filter_rule2(const char * ifname, pcr.rule.flags = TH_SYN; pcr.rule.flagset = (TH_SYN|TH_ACK); #ifdef PFRULE_HAS_RTABLEID - pcr.rule.rtableid = -1; /* first appeared in OpenBSD 4.0 */ + pcr.rule.rtableid = -1; /* first appeared in OpenBSD 4.0 */ #endif #ifdef PFRULE_HAS_ONRDOMAIN pcr.rule.onrdomain = -1; /* first appeared in OpenBSD 5.0 */ @@ -402,7 +402,7 @@ add_filter_rule2(const char * ifname, TAILQ_INIT(&pcr.rule.rpool.list); inet_pton(AF_INET, iaddr, &a->addr.v.a.addr.v4.s_addr); TAILQ_INSERT_TAIL(&pcr.rule.rpool.list, a, entries); - + /* we have any - any port = # keep state label */ /* we want any - iaddr port = # keep state label */ /* memcpy(&pcr.rule.dst, a, sizeof(struct pf_pooladdr)); */ diff --git a/miniupnpd/pf/obsdrdr.h b/miniupnpd/pf/obsdrdr.h index fa34286..65a3d98 100644 --- a/miniupnpd/pf/obsdrdr.h +++ b/miniupnpd/pf/obsdrdr.h @@ -1,7 +1,7 @@ /* $Id: obsdrdr.h,v 1.19 2011/06/04 15:47:18 nanard Exp $ */ /* MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ - * (c) 2006 Thomas Bernard + * (c) 2006 Thomas Bernard * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ @@ -27,7 +27,7 @@ add_filter_rule2(const char * ifname, const char * rhost, const char * iaddr, unsigned short eport, unsigned short iport, int proto, const char * desc); - + /* get_redirect_rule() gets internal IP and port from * interface, external port and protocl diff --git a/miniupnpd/pf/testobsdrdr.c b/miniupnpd/pf/testobsdrdr.c index 473500b..408c85e 100644 --- a/miniupnpd/pf/testobsdrdr.c +++ b/miniupnpd/pf/testobsdrdr.c @@ -1,7 +1,7 @@ /* $Id: testobsdrdr.c,v 1.22 2011/06/04 16:45:22 nanard Exp $ */ /* MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ - * (c) 2006-2011 Thomas Bernard + * (c) 2006-2011 Thomas Bernard * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ @@ -91,7 +91,7 @@ main(int arc, char * * argv) list_rules(); list_eports_tcp(); - + if(get_redirect_rule("xl1", 4662, IPPROTO_TCP, buf, sizeof(buf), &iport, desc, sizeof(desc), diff --git a/miniupnpd/solaris/getifstats.c b/miniupnpd/solaris/getifstats.c index 048d8e6..5317b96 100644 --- a/miniupnpd/solaris/getifstats.c +++ b/miniupnpd/solaris/getifstats.c @@ -14,7 +14,7 @@ #include "../getifstats.h" -int +int getifstats(const char * ifname, struct ifdata * data) { char buffer[64], *s; diff --git a/miniupnpd/testgetifaddr.c b/miniupnpd/testgetifaddr.c index 3565186..6291c7e 100644 --- a/miniupnpd/testgetifaddr.c +++ b/miniupnpd/testgetifaddr.c @@ -1,7 +1,7 @@ /* $Id: testgetifaddr.c,v 1.3 2011/04/11 10:41:57 nanard Exp $ */ /* MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ - * (c) 2006-2011 Thomas Bernard + * (c) 2006-2011 Thomas Bernard * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ #include diff --git a/miniupnpd/testgetifstats.c b/miniupnpd/testgetifstats.c index 0e3aa6f..ec22591 100644 --- a/miniupnpd/testgetifstats.c +++ b/miniupnpd/testgetifstats.c @@ -1,7 +1,7 @@ /* $Id: testgetifstats.c,v 1.4 2007/02/07 22:14:47 nanard Exp $ */ /* MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ - * (c) 2006 Thomas Bernard + * (c) 2006 Thomas Bernard * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ diff --git a/miniupnpd/testupnpdescgen.c b/miniupnpd/testupnpdescgen.c index 07bb208..3fe9ca4 100644 --- a/miniupnpd/testupnpdescgen.c +++ b/miniupnpd/testupnpdescgen.c @@ -1,7 +1,7 @@ /* $Id: testupnpdescgen.c,v 1.27 2012/02/04 23:34:39 nanard Exp $ */ /* MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ - * (c) 2006-2012 Thomas Bernard + * (c) 2006-2012 Thomas Bernard * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ diff --git a/miniupnpd/upnpdescgen.c b/miniupnpd/upnpdescgen.c index 51dd54c..bb89bb4 100644 --- a/miniupnpd/upnpdescgen.c +++ b/miniupnpd/upnpdescgen.c @@ -1,7 +1,7 @@ /* $Id: upnpdescgen.c,v 1.64 2012/02/04 23:05:21 nanard Exp $ */ /* MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ - * (c) 2006-2012 Thomas Bernard + * (c) 2006-2012 Thomas Bernard * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ @@ -118,15 +118,15 @@ static const char * magicargname[] = { "IsWorking" }; -static const char xmlver[] = +static const char xmlver[] = "\r\n"; static const char root_service[] = "scpd xmlns=\"urn:schemas-upnp-org:service-1-0\""; -static const char root_device[] = +static const char root_device[] = "root xmlns=\"urn:schemas-upnp-org:device-1-0\""; -/* root Description of the UPnP Device - * fixed to match UPnP_IGD_InternetGatewayDevice 1.0.pdf +/* root Description of the UPnP Device + * fixed to match UPnP_IGD_InternetGatewayDevice 1.0.pdf * Needs to be checked with UPnP-gw-InternetGatewayDevice-v2-Device.pdf * presentationURL is only "recommended" but the router doesn't appears * in "Network connections" in Windows XP if it is not present. */ @@ -277,7 +277,7 @@ static const struct XMLElt rootDesc[] = {"/SCPDURL", L3F_PATH}, #endif #ifdef ENABLE_DP_SERVICE -/* InternetGatewayDevice v2 : +/* InternetGatewayDevice v2 : * it is RECOMMEDED that DeviceProtection service is implemented and applied. * If DeviceProtection is not implemented and applied, it is RECOMMENDED * that control points are able to access only actions and parameters defined @@ -355,7 +355,7 @@ static const struct argument GetExternalIPAddressArgs[] = {0, 0} }; -static const struct argument DeletePortMappingArgs[] = +static const struct argument DeletePortMappingArgs[] = { {1, 11}, {1, 12}, @@ -502,7 +502,7 @@ static const struct stateVar WANIPCnVars[] = {"PortMappingEnabled", 1, 0}, /* Required */ /* 10 */ {"PortMappingLeaseDuration", 3, 2, 1}, /* required */ - /* TODO : for IGD v2 : + /* TODO : for IGD v2 : * * PortMappingLeaseDuration * ui4 @@ -580,14 +580,14 @@ static const struct action WANCfgActions[] = static const struct stateVar WANCfgVars[] = { {"WANAccessType", 0, 0, 1}, - /* Allowed Values : DSL / POTS / Cable / Ethernet + /* Allowed Values : DSL / POTS / Cable / Ethernet * Default value : empty string */ {"Layer1UpstreamMaxBitRate", 3, 0}, {"Layer1DownstreamMaxBitRate", 3, 0}, {"PhysicalLinkStatus", 0|0x80, 0, 6, 6}, - /* allowed values : + /* allowed values : * Up / Down / Initializing (optional) / Unavailable (optionnal) - * no Default value + * no Default value * Evented */ {"TotalBytesSent", 3, 0}, /* Optional */ {"TotalBytesReceived", 3, 0}, /* Optional */ @@ -914,7 +914,7 @@ genXML(char * str, int * len, int * tmplen, /* genRootDesc() : * - Generate the root description of the UPnP device. * - the len argument is used to return the length of - * the returned string. + * the returned string. * - tmp_uuid argument is used to build the uuid string */ char * genRootDesc(int * len) @@ -934,7 +934,7 @@ genRootDesc(int * len) } /* genServiceDesc() : - * Generate service description with allowed methods and + * Generate service description with allowed methods and * related variables. */ static char * genServiceDesc(int * len, const struct serviceDesc * s) @@ -953,7 +953,7 @@ genServiceDesc(int * len, const struct serviceDesc * s) /*strcpy(str, xmlver); */ *len = strlen(xmlver); memcpy(str, xmlver, *len + 1); - + acts = s->actionList; vars = s->serviceStateTable; diff --git a/miniupnpd/upnpdescgen.h b/miniupnpd/upnpdescgen.h index cec866e..8a39088 100644 --- a/miniupnpd/upnpdescgen.h +++ b/miniupnpd/upnpdescgen.h @@ -1,7 +1,7 @@ /* $Id: upnpdescgen.h,v 1.22 2011/05/18 22:22:24 nanard Exp $ */ /* MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ - * (c) 2006-2011 Thomas Bernard + * (c) 2006-2011 Thomas Bernard * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ @@ -10,7 +10,7 @@ #include "config.h" -/* for the root description +/* for the root description * The child list reference is stored in "data" member using the * INITHELPER macro with index/nchild always in the * same order, whatever the endianness */ @@ -31,7 +31,7 @@ struct action { }; struct argument { /* the name of the arg is obtained from the variable */ - unsigned char dir; /* MSB : don't append "New" Flag, + unsigned char dir; /* MSB : don't append "New" Flag, * 5 Medium bits : magic argument name index * 2 LSB : 1 = in, 2 = out */ unsigned char relatedVar; /* index of the related variable */ @@ -41,12 +41,12 @@ struct stateVar { const char * name; unsigned char itype; /* MSB: sendEvent flag, 7 LSB: index in upnptypes */ unsigned char idefault; /* default value */ - unsigned char iallowedlist; /* index in allowed values list + unsigned char iallowedlist; /* index in allowed values list * or in allowed range list */ unsigned char ieventvalue; /* fixed value returned or magical values */ }; -/* little endian +/* little endian * The code has now be tested on big endian architecture */ #define INITHELPER(i, n) ((char *)(((n)<<16)|(i))) diff --git a/miniupnpd/upnpevents.c b/miniupnpd/upnpevents.c index 1ef545c..88efff5 100644 --- a/miniupnpd/upnpevents.c +++ b/miniupnpd/upnpevents.c @@ -299,7 +299,7 @@ upnp_event_notify_connect(struct upnp_event_notify * obj) static void upnp_event_prepare(struct upnp_event_notify * obj) { - static const char notifymsg[] = + static const char notifymsg[] = "NOTIFY %s HTTP/1.1\r\n" "Host: %s%s\r\n" "Content-Type: text/xml\r\n" diff --git a/miniupnpd/upnpglobalvars.c b/miniupnpd/upnpglobalvars.c index 746d324..5c79af3 100644 --- a/miniupnpd/upnpglobalvars.c +++ b/miniupnpd/upnpglobalvars.c @@ -1,7 +1,7 @@ /* $Id: upnpglobalvars.c,v 1.27 2012/02/04 23:05:21 nanard Exp $ */ /* MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ - * (c) 2006-2012 Thomas Bernard + * (c) 2006-2012 Thomas Bernard * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ @@ -43,7 +43,7 @@ char modelnumber[MODELNUMBER_MAX_LEN] = "1"; /* presentation url : * http://nnn.nnn.nnn.nnn:ppppp/ => max 30 bytes including terminating 0 */ -char presentationurl[PRESENTATIONURL_MAX_LEN]; +char presentationurl[PRESENTATIONURL_MAX_LEN]; /* friendly name for root devices in XML description */ char friendly_name[FRIENDLY_NAME_MAX_LEN] = OS_NAME " router"; diff --git a/miniupnpd/upnpglobalvars.h b/miniupnpd/upnpglobalvars.h index 325479f..f7cd47f 100644 --- a/miniupnpd/upnpglobalvars.h +++ b/miniupnpd/upnpglobalvars.h @@ -1,7 +1,7 @@ /* $Id: upnpglobalvars.h,v 1.31 2012/02/04 23:05:21 nanard Exp $ */ /* MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ - * (c) 2006-2012 Thomas Bernard + * (c) 2006-2012 Thomas Bernard * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ diff --git a/miniupnpd/upnphttp.c b/miniupnpd/upnphttp.c index 19f9b75..b583377 100644 --- a/miniupnpd/upnphttp.c +++ b/miniupnpd/upnphttp.c @@ -26,7 +26,7 @@ #include "upnpevents.h" #include "upnputils.h" -struct upnphttp * +struct upnphttp * New_upnphttp(int s) { struct upnphttp * ret; @@ -177,7 +177,7 @@ Send404(struct upnphttp * h) static void Send501(struct upnphttp * h) { - static const char body501[] = + static const char body501[] = "501 Not Implemented" "

Not Implemented

The HTTP Method " "is not implemented by this server.\r\n"; @@ -254,7 +254,7 @@ ProcessHTTPPOST_upnphttp(struct upnphttp * h) /* we can process the request */ syslog(LOG_INFO, "SOAPAction: %.*s", h->req_soapActionLen, h->req_soapAction); - ExecuteSoapAction(h, + ExecuteSoapAction(h, h->req_soapAction, h->req_soapActionLen); } @@ -357,7 +357,7 @@ ProcessHTTPSubscribe_upnphttp(struct upnphttp * h, const char * path) SendRespAndClose_upnphttp(h); } else { /* - add to the subscriber list - * - respond HTTP/x.x 200 OK + * - respond HTTP/x.x 200 OK * - Send the initial event message */ /* Server:, SID:; Timeout: Second-(xx|infinite) */ /* Check that the callback URL is on the same IP as @@ -411,7 +411,7 @@ ProcessHTTPUnSubscribe_upnphttp(struct upnphttp * h, const char * path) } #endif -/* Parse and process Http Query +/* Parse and process Http Query * called once all the HTTP headers have been received. */ static void ProcessHttpQuery_upnphttp(struct upnphttp * h) diff --git a/miniupnpd/upnphttp.h b/miniupnpd/upnphttp.h index 70278c3..d71f77c 100644 --- a/miniupnpd/upnphttp.h +++ b/miniupnpd/upnphttp.h @@ -1,7 +1,7 @@ /* $Id: upnphttp.h,v 1.26 2012/02/07 00:21:54 nanard Exp $ */ /* MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ - * (c) 2006-2011 Thomas Bernard + * (c) 2006-2011 Thomas Bernard * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ @@ -103,7 +103,7 @@ BuildHeader_upnphttp(struct upnphttp * h, int respcode, const char * respmsg, int bodylen); -/* BuildResp_upnphttp() +/* BuildResp_upnphttp() * fill the res_buf buffer with the complete * HTTP 200 OK response from the body passed as argument */ void diff --git a/miniupnpd/upnppermissions.h b/miniupnpd/upnppermissions.h index e0a9519..f095f00 100644 --- a/miniupnpd/upnppermissions.h +++ b/miniupnpd/upnppermissions.h @@ -29,14 +29,14 @@ struct upnpperm { * -1 error reading line * * line sample : - * allow 1024-65535 192.168.3.0/24 1024-65535 + * allow 1024-65535 192.168.3.0/24 1024-65535 * allow 22 192.168.4.33/32 22 * deny 0-65535 0.0.0.0/0 0-65535 */ int read_permission_line(struct upnpperm * perm, char * p); -/* check_upnp_rule_against_permissions() +/* check_upnp_rule_against_permissions() * returns: 0 if the upnp rule should be rejected, * 1 if it could be accepted */ int diff --git a/miniupnpd/upnpredirect.c b/miniupnpd/upnpredirect.c index 691f9d3..ed65c47 100644 --- a/miniupnpd/upnpredirect.c +++ b/miniupnpd/upnpredirect.c @@ -1,7 +1,7 @@ /* $Id: upnpredirect.c,v 1.60 2011/06/22 20:34:39 nanard Exp $ */ /* MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ - * (c) 2006-2011 Thomas Bernard + * (c) 2006-2011 Thomas Bernard * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ @@ -47,7 +47,7 @@ #define PRIu64 "llu" #endif -/* proto_atoi() +/* proto_atoi() * convert the string "UDP" or "TCP" to IPPROTO_UDP and IPPROTO_UDP */ static int proto_atoi(const char * protocol) @@ -81,7 +81,7 @@ lease_file_add(unsigned short eport, ((proto==IPPROTO_TCP)?"TCP":"UDP"), eport, iaddr, iport, timestamp, desc); fclose(fd); - + return 0; } @@ -133,14 +133,14 @@ lease_file_remove(unsigned short eport, int proto) } fclose(fdt); fclose(fd); - + if (rename(tmpfilename, lease_file) < 0) { syslog(LOG_ERR, "could not rename temporary lease file to %s", lease_file); remove(tmpfilename); } - + return 0; - + } /* reload_from_lease_file() @@ -239,12 +239,12 @@ int reload_from_lease_file() } } fclose(fd); - + return 0; } #endif -/* upnp_redirect() +/* upnp_redirect() * calls OS/fw dependant implementation of the redirection. * protocol should be the string "TCP" or "UDP" * returns: 0 on success @@ -253,7 +253,7 @@ int reload_from_lease_file() * -3 permission check failed */ int -upnp_redirect(const char * rhost, unsigned short eport, +upnp_redirect(const char * rhost, unsigned short eport, const char * iaddr, unsigned short iport, const char * protocol, const char * desc, unsigned int leaseduration) @@ -295,7 +295,7 @@ upnp_redirect(const char * rhost, unsigned short eport, } else { timestamp = (leaseduration > 0) ? time(NULL) + leaseduration : 0; syslog(LOG_INFO, "redirecting port %hu to %s:%hu protocol %s for: %s", - eport, iaddr, iport, protocol, desc); + eport, iaddr, iport, protocol, desc); return upnp_redirect_internal(rhost, eport, iaddr, iport, proto, desc, timestamp); } @@ -374,7 +374,7 @@ upnp_get_redirection_infos(unsigned short eport, const char * protocol, int upnp_get_redirection_infos_by_index(int index, unsigned short * eport, char * protocol, - unsigned short * iport, + unsigned short * iport, char * iaddr, int iaddrlen, char * desc, int desclen, char * rhost, int rhostlen, @@ -794,7 +794,7 @@ upnp_delete_inboundpinhole(const char * uid) { /* TODO : to be implemented */ #if 0 - /* this is a alpha implementation calling ip6tables via system(), + /* this is a alpha implementation calling ip6tables via system(), * it can be usefull as an example to code the netfilter version */ int r, s, linenum=0; char cmd[256], cmd_raw[256]; diff --git a/miniupnpd/upnpredirect.h b/miniupnpd/upnpredirect.h index 63b7e3d..916785e 100644 --- a/miniupnpd/upnpredirect.h +++ b/miniupnpd/upnpredirect.h @@ -1,7 +1,7 @@ /* $Id: upnpredirect.h,v 1.24 2011/06/22 20:34:39 nanard Exp $ */ /* MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ - * (c) 2006-2011 Thomas Bernard + * (c) 2006-2011 Thomas Bernard * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ @@ -17,7 +17,7 @@ int reload_from_lease_file(void); #endif -/* upnp_redirect() +/* upnp_redirect() * calls OS/fw dependant implementation of the redirection. * protocol should be the string "TCP" or "UDP" * returns: 0 on success @@ -26,7 +26,7 @@ int reload_from_lease_file(void); * -3 permission check failed */ int -upnp_redirect(const char * rhost, unsigned short eport, +upnp_redirect(const char * rhost, unsigned short eport, const char * iaddr, unsigned short iport, const char * protocol, const char * desc, unsigned int leaseduration); @@ -55,7 +55,7 @@ upnp_get_redirection_infos(unsigned short eport, const char * protocol, int upnp_get_redirection_infos_by_index(int index, unsigned short * eport, char * protocol, - unsigned short * iport, + unsigned short * iport, char * iaddr, int iaddrlen, char * desc, int desclen, char * rhost, int rhostlen, @@ -81,7 +81,7 @@ struct rule_state struct rule_state * next; unsigned short eport; unsigned char proto; - unsigned char to_remove; + unsigned char to_remove; }; /* return a linked list of all rules diff --git a/miniupnpd/upnpreplyparse.c b/miniupnpd/upnpreplyparse.c index 482030b..c89d2e0 100644 --- a/miniupnpd/upnpreplyparse.c +++ b/miniupnpd/upnpreplyparse.c @@ -1,7 +1,7 @@ /* $Id: upnpreplyparse.c,v 1.11 2011/02/07 16:17:06 nanard Exp $ */ /* MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ - * (c) 2006-2011 Thomas Bernard + * (c) 2006-2011 Thomas Bernard * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ @@ -90,7 +90,7 @@ ClearNameValueList(struct NameValueParserData * pdata) } } -char * +char * GetValueFromNameValueList(struct NameValueParserData * pdata, const char * Name) { @@ -131,7 +131,7 @@ GetValueFromNameValueListIgnoreNS(struct NameValueParserData * pdata, } #endif -/* debug all-in-one function +/* debug all-in-one function * do parsing then display to stdout */ #ifdef DEBUG void diff --git a/miniupnpd/upnpreplyparse.h b/miniupnpd/upnpreplyparse.h index 851ebaf..3b302ba 100644 --- a/miniupnpd/upnpreplyparse.h +++ b/miniupnpd/upnpreplyparse.h @@ -1,14 +1,14 @@ /* $Id: upnpreplyparse.h,v 1.12 2012/01/21 13:30:33 nanard Exp $ */ /* MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ - * (c) 2006-2012 Thomas Bernard + * (c) 2006-2012 Thomas Bernard * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ #ifndef __UPNPREPLYPARSE_H__ #define __UPNPREPLYPARSE_H__ -#if defined(NO_SYS_QUEUE_H) || defined(_WIN32) || defined(__HAIKU__) +#if defined(NO_SYS_QUEUE_H) || defined(_WIN32) || defined(__HAIKU__) #include "bsdqueue.h" #else #include diff --git a/miniupnpd/upnpsoap.c b/miniupnpd/upnpsoap.c index f0bf7dc..dec2323 100644 --- a/miniupnpd/upnpsoap.c +++ b/miniupnpd/upnpsoap.c @@ -1,7 +1,7 @@ /* $Id: upnpsoap.c,v 1.90 2012/02/04 23:34:40 nanard Exp $ */ /* MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ - * (c) 2006-2012 Thomas Bernard + * (c) 2006-2012 Thomas Bernard * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ @@ -219,7 +219,7 @@ GetStatusInfo(struct upnphttp * h, const char * action) uptime = (time(NULL) - startup_time); bodylen = snprintf(body, sizeof(body), resp, action, SERVICE_TYPE_WANIPC, - status, (long)uptime, action); + status, (long)uptime, action); BuildSendAndCloseSoapResp(h, body, bodylen); } @@ -334,11 +334,11 @@ AddPortMapping(struct upnphttp * h, const char * action) #endif /* if ip not valid assume hostname and convert */ - if (inet_pton(AF_INET, int_ip, &result_ip) <= 0) + if (inet_pton(AF_INET, int_ip, &result_ip) <= 0) { hp = gethostbyname(int_ip); - if(hp && hp->h_addrtype == AF_INET) - { + if(hp && hp->h_addrtype == AF_INET) + { for(ptr = hp->h_addr_list; ptr && *ptr; ptr++) { int_ip = inet_ntoa(*((struct in_addr *) *ptr)); @@ -346,14 +346,14 @@ AddPortMapping(struct upnphttp * h, const char * action) /* TODO : deal with more than one ip per hostname */ break; } - } - else + } + else { - syslog(LOG_ERR, "Failed to convert hostname '%s' to ip address", int_ip); + syslog(LOG_ERR, "Failed to convert hostname '%s' to ip address", int_ip); ClearNameValueList(&data); SoapError(h, 402, "Invalid Args"); return; - } + } } /* check if NewInternalAddress is the client address */ @@ -500,11 +500,11 @@ AddAnyPortMapping(struct upnphttp * h, const char * action) #endif /* if ip not valid assume hostname and convert */ - if (inet_pton(AF_INET, int_ip, &result_ip) <= 0) + if (inet_pton(AF_INET, int_ip, &result_ip) <= 0) { hp = gethostbyname(int_ip); - if(hp && hp->h_addrtype == AF_INET) - { + if(hp && hp->h_addrtype == AF_INET) + { for(ptr = hp->h_addr_list; ptr && *ptr; ptr++) { int_ip = inet_ntoa(*((struct in_addr *) *ptr)); @@ -512,14 +512,14 @@ AddAnyPortMapping(struct upnphttp * h, const char * action) /* TODO : deal with more than one ip per hostname */ break; } - } - else + } + else { - syslog(LOG_ERR, "Failed to convert hostname '%s' to ip address", int_ip); + syslog(LOG_ERR, "Failed to convert hostname '%s' to ip address", int_ip); ClearNameValueList(&data); SoapError(h, 402, "Invalid Args"); return; - } + } } /* check if NewInternalAddress is the client address */ @@ -535,7 +535,7 @@ AddAnyPortMapping(struct upnphttp * h, const char * action) } } - /* TODO : accept a different external port + /* TODO : accept a different external port * have some smart strategy to choose the port */ for(;;) { r = upnp_redirect(r_host, eport, int_ip, iport, protocol, desc, leaseduration); @@ -626,7 +626,7 @@ GetSpecificPortMappingEntry(struct upnphttp * h, const char * action) &leaseduration); if(r < 0) - { + { SoapError(h, 714, "NoSuchEntryInArray"); } else @@ -687,13 +687,13 @@ DeletePortMapping(struct upnphttp * h, const char * action) * just an annoyance for the user using it. So this is not * a priority. */ - syslog(LOG_INFO, "%s: external port: %hu, protocol: %s", + syslog(LOG_INFO, "%s: external port: %hu, protocol: %s", action, eport, protocol); r = upnp_delete_redirection(eport, protocol); if(r < 0) - { + { SoapError(h, 714, "NoSuchEntryInArray"); } else @@ -755,7 +755,7 @@ static void GetGenericPortMappingEntry(struct upnphttp * h, const char * action) { int r; - + static const char resp[] = "" @@ -786,7 +786,7 @@ GetGenericPortMappingEntry(struct upnphttp * h, const char * action) ClearNameValueList(&data); SoapError(h, 402, "Invalid Args"); return; - } + } index = (int)atoi(m_index); @@ -1062,7 +1062,7 @@ QueryStateVariable(struct upnphttp * h, const char * action) SoapError(h, 402, "Invalid Args"); } else if(strcmp(var_name, "ConnectionStatus") == 0) - { + { const char * status; status = get_wan_connection_status_str(ext_if_name); @@ -1074,12 +1074,12 @@ QueryStateVariable(struct upnphttp * h, const char * action) #if 0 /* not usefull */ else if(strcmp(var_name, "ConnectionType") == 0) - { + { bodylen = snprintf(body, sizeof(body), resp, "IP_Routed"); BuildSendAndCloseSoapResp(h, body, bodylen); } else if(strcmp(var_name, "LastConnectionError") == 0) - { + { bodylen = snprintf(body, sizeof(body), resp, "ERROR_NONE"); BuildSendAndCloseSoapResp(h, body, bodylen); } @@ -1100,7 +1100,7 @@ QueryStateVariable(struct upnphttp * h, const char * action) SoapError(h, 404, "Invalid Var"); } - ClearNameValueList(&data); + ClearNameValueList(&data); } #ifdef ENABLE_6FC_SERVICE @@ -1153,7 +1153,7 @@ DataVerification(struct upnphttp * h, char * int_ip, unsigned short * int_port, SoapError(h, 708, "WildCardNotPermittedInSrcIP"); return 0; } - + if (!strchr(int_ip, ':')) { SoapError(h, 402, "Invalid Args"); @@ -1265,7 +1265,7 @@ PinholeVerification(struct upnphttp * h, char * int_ip, unsigned short * int_por //char str[INET6_ADDRSTRLEN]=""; //connecthostport(int_ip, *int_port, str); //printf("int_ip: %s / str: %s\n", int_ip, str); - + struct addrinfo hints, *ai, *p; struct in6_addr result_ip;/*unsigned char result_ip[16];*/ /* inet_pton() */ //IPv6 Modification @@ -1739,9 +1739,9 @@ GetPinholePackets(struct upnphttp * h, const char * action) * GetExternalIPAddress * QueryStateVariable / ConnectionStatus! */ -static const struct +static const struct { - const char * methodName; + const char * methodName; void (*methodImpl)(struct upnphttp *, const char *); } soapMethods[] = @@ -1829,7 +1829,7 @@ ExecuteSoapAction(struct upnphttp * h, const char * action, int n) * -------- ---------------- ----------- * 401 Invalid Action No action by that name at this service. * 402 Invalid Args Could be any of the following: not enough in args, - * too many in args, no in arg by that name, + * too many in args, no in arg by that name, * one or more in args are of the wrong data type. * 403 Out of Sync Out of synchronization. * 501 Action Failed May be returned in current state of service @@ -1838,13 +1838,13 @@ ExecuteSoapAction(struct upnphttp * h, const char * action, int n) * Technical Committee. * 700-799 TBD Action-specific errors for standard actions. * Defined by UPnP Forum working committee. - * 800-899 TBD Action-specific errors for non-standard actions. + * 800-899 TBD Action-specific errors for non-standard actions. * Defined by UPnP vendor. */ void SoapError(struct upnphttp * h, int errCode, const char * errDesc) { - static const char resp[] = + static const char resp[] = "" diff --git a/miniupnpd/upnpsoap.h b/miniupnpd/upnpsoap.h index 0df1899..b3c8e91 100644 --- a/miniupnpd/upnpsoap.h +++ b/miniupnpd/upnpsoap.h @@ -1,7 +1,7 @@ /* $Id: upnpsoap.h,v 1.8 2007/02/07 22:16:19 nanard Exp $ */ /* MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ - * (c) 2006 Thomas Bernard + * (c) 2006 Thomas Bernard * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ @@ -14,7 +14,7 @@ void ExecuteSoapAction(struct upnphttp *, const char *, int); /* SoapError(): - * sends a correct SOAP error with an UPNPError code and + * sends a correct SOAP error with an UPNPError code and * description */ void SoapError(struct upnphttp * h, int errCode, const char * errDesc); diff --git a/miniupnpd/upnpurns.h b/miniupnpd/upnpurns.h index 7383828..43011c5 100644 --- a/miniupnpd/upnpurns.h +++ b/miniupnpd/upnpurns.h @@ -1,7 +1,7 @@ /* $Id: upnpurns.h,v 1.1 2011/05/13 15:32:53 nanard Exp $ */ /* MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ - * (c) 2006-2011 Thomas Bernard + * (c) 2006-2011 Thomas Bernard * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */