This commit is contained in:
yangfl 2018-01-09 09:32:39 +08:00
parent 17345b05ac
commit d492fa39ef
28 changed files with 38 additions and 38 deletions

View File

@ -157,7 +157,7 @@ ProcessInterfaceWatch(int s, int s_ssdp, int s_ssdp6)
{ {
struct ifa_cacheinfo *cache_info; struct ifa_cacheinfo *cache_info;
cache_info = RTA_DATA(rta); cache_info = RTA_DATA(rta);
snprintf(tmp, sizeof(tmp), "valid=%u prefered=%u", snprintf(tmp, sizeof(tmp), "valid=%u preferred=%u",
cache_info->ifa_valid, cache_info->ifa_prefered); cache_info->ifa_valid, cache_info->ifa_prefered);
} }
break; break;

View File

@ -28,7 +28,7 @@ By default /var/run/minissdpd.pid is used.
.TP .TP
.B \-i interface .B \-i interface
name or IP address of the interface used to listen to SSDP packets name or IP address of the interface used to listen to SSDP packets
comming on port 1900, multicast address 239.255.255.250. coming on port 1900, multicast address 239.255.255.250.
.SH "SEE ALSO" .SH "SEE ALSO"
miniupnpd(1) miniupnpc(3) miniupnpd(1) miniupnpc(3)
.SH BUGS .SH BUGS

View File

@ -49,7 +49,7 @@
#define SET_MAX(max, x) if((x) > (max)) (max) = (x) #define SET_MAX(max, x) if((x) > (max)) (max) = (x)
/* current request management stucture */ /* current request management structure */
struct reqelem { struct reqelem {
int socket; int socket;
int is_notify; /* has subscribed to notifications */ int is_notify; /* has subscribed to notifications */

View File

@ -26,6 +26,6 @@ int main(int argc, char * * argv)
return 1; return 1;
} }
} }
printf("Test succesful\n"); printf("Test successful\n");
return 0; return 0;
} }

View File

@ -984,7 +984,7 @@ int upnpc_process(upnpc_t * p)
upnpc_device_t * d; upnpc_device_t * d;
/* /*
1) Envoyer les paquets de discovery SSDP 1) Envoyer les paquets de discovery SSDP
2) Recevoir et traiter les reponses 2) Recevoir et traiter les responses
3) recup les descriptions 3) recup les descriptions
4) tester les etats 4) tester les etats
*/ */

View File

@ -65,7 +65,7 @@
#define debug_printf(...) (void)0 #define debug_printf(...) (void)0
#endif #endif
/* compare the begining of a string with a constant string */ /* compare the beginning of a string with a constant string */
#define COMPARE(str, cstr) (0==memcmp(str, cstr, sizeof(cstr) - 1)) #define COMPARE(str, cstr) (0==memcmp(str, cstr, sizeof(cstr) - 1))
/* stuctures */ /* stuctures */

View File

@ -602,7 +602,7 @@ VERSION 1.0 :
upnpc now displays external ip address with -s or -l upnpc now displays external ip address with -s or -l
2007/04/11: 2007/04/11:
changed MINIUPNPC_URL_MAXSIZE to 128 to accomodate the "BT Voyager 210" changed MINIUPNPC_URL_MAXSIZE to 128 to accommodate the "BT Voyager 210"
2007/03/19: 2007/03/19:
cleanup in miniwget.c cleanup in miniwget.c

View File

@ -43,7 +43,7 @@ browse the list of device returned by upnpDiscover(), find
a live UPnP internet gateway device and fill structures passed as arguments a live UPnP internet gateway device and fill structures passed as arguments
with data used for UPNP methods invokation. with data used for UPNP methods invokation.
.IP "int UPNP_GetIGDFromUrl(const char * rootdescurl, struct UPNPUrls * urls, struct IGDdatas * data, char * lanaddr, int lanaddrlen);" .IP "int UPNP_GetIGDFromUrl(const char * rootdescurl, struct UPNPUrls * urls, struct IGDdatas * data, char * lanaddr, int lanaddrlen);"
permit to bypass the upnpDiscover() call if the xml root description permit one to bypass the upnpDiscover() call if the xml root description
URL of the UPnP IGD is known. URL of the UPnP IGD is known.
Fill structures passed as arguments Fill structures passed as arguments
with data used for UPNP methods invokation. with data used for UPNP methods invokation.

View File

@ -511,7 +511,7 @@ int main(int argc, char * * argv) {
fprintf(stderr, "unknown command line switch '%s'\n", argv[i]); fprintf(stderr, "unknown command line switch '%s'\n", argv[i]);
} }
} else { } else {
fprintf(stderr, "unkown command line argument '%s'\n", argv[i]); fprintf(stderr, "unknown command line argument '%s'\n", argv[i]);
} }
} }

View File

@ -55,7 +55,7 @@ httpWrite(int fd, const char * body, int bodysize,
PRINT_SOCKET_ERROR("send"); PRINT_SOCKET_ERROR("send");
} }
/* disable send on the socket */ /* disable send on the socket */
/* draytek routers dont seems to like that... */ /* draytek routers don't seems to like that... */
#if 0 #if 0
#ifdef _WIN32 #ifdef _WIN32
if(shutdown(fd, SD_SEND)<0) { if(shutdown(fd, SD_SEND)<0) {

View File

@ -61,7 +61,7 @@
#include "upnpcommands.h" #include "upnpcommands.h"
#include "connecthostport.h" #include "connecthostport.h"
/* compare the begining of a string with a constant string */ /* compare the beginning of a string with a constant string */
#define COMPARE(str, cstr) (0==memcmp(str, cstr, sizeof(cstr) - 1)) #define COMPARE(str, cstr) (0==memcmp(str, cstr, sizeof(cstr) - 1))
#ifndef MAXHOSTNAMELEN #ifndef MAXHOSTNAMELEN
@ -550,7 +550,7 @@ UPNPIGD_IsConnected(struct UPNPUrls * urls, struct IGDdatas * data)
* 3 = an UPnP device has been found but was not recognized as an IGD * 3 = an UPnP device has been found but was not recognized as an IGD
* *
* In any positive non zero return case, the urls and data structures * In any positive non zero return case, the urls and data structures
* passed as parameters are set. Dont forget to call FreeUPNPUrls(urls) to * passed as parameters are set. Don't forget to call FreeUPNPUrls(urls) to
* free allocated memory. * free allocated memory.
*/ */
MINIUPNP_LIBSPEC int MINIUPNP_LIBSPEC int
@ -634,7 +634,7 @@ UPNP_GetValidIGD(struct UPNPDev * devlist,
GetUPNPUrls(urls, data, dev->descURL, dev->scope_id); GetUPNPUrls(urls, data, dev->descURL, dev->scope_id);
/* in state 2 and 3 we dont test if device is connected ! */ /* in state 2 and 3 we don't test if device is connected ! */
if(state >= 2) if(state >= 2)
goto free_and_return; goto free_and_return;
is_connected = UPNPIGD_IsConnected(urls, data); is_connected = UPNPIGD_IsConnected(urls, data);

View File

@ -23,7 +23,7 @@
#define MINIUPNPC_API_VERSION 16 #define MINIUPNPC_API_VERSION 16
/* Source port: /* Source port:
Using "1" as an alias for 1900 for backwards compatability Using "1" as an alias for 1900 for backwards compatibility
(presuming one would have used that for the "sameport" parameter) */ (presuming one would have used that for the "sameport" parameter) */
#define UPNP_LOCAL_PORT_ANY 0 #define UPNP_LOCAL_PORT_ANY 0
#define UPNP_LOCAL_PORT_SAME 1 #define UPNP_LOCAL_PORT_SAME 1

View File

@ -47,7 +47,7 @@ print ' lanaddr', u.lanaddr
print ' multicastif', u.multicastif print ' multicastif', u.multicastif
print ' minissdpdsocket', u.minissdpdsocket print ' minissdpdsocket', u.minissdpdsocket
#u.minissdpdsocket = '../minissdpd/minissdpd.sock' #u.minissdpdsocket = '../minissdpd/minissdpd.sock'
# discovery process, it usualy takes several seconds (2 seconds or more) # discovery process, it usually takes several seconds (2 seconds or more)
print 'Discovering... delay=%ums' % u.discoverdelay print 'Discovering... delay=%ums' % u.discoverdelay
print u.discover(), 'device(s) detected' print u.discover(), 'device(s) detected'
# select an igd # select an igd

View File

@ -17,7 +17,7 @@ print(' multicastif', u.multicastif)
print(' minissdpdsocket', u.minissdpdsocket) print(' minissdpdsocket', u.minissdpdsocket)
u.discoverdelay = 200; u.discoverdelay = 200;
#u.minissdpdsocket = '../minissdpd/minissdpd.sock' #u.minissdpdsocket = '../minissdpd/minissdpd.sock'
# discovery process, it usualy takes several seconds (2 seconds or more) # discovery process, it usually takes several seconds (2 seconds or more)
print('Discovering... delay=%ums' % u.discoverdelay) print('Discovering... delay=%ums' % u.discoverdelay)
print(u.discover(), 'device(s) detected') print(u.discover(), 'device(s) detected')
# select an igd # select an igd

View File

@ -11,7 +11,7 @@
/** /**
* This program uses the miniwget / miniwget_getaddr function * This program uses the miniwget / miniwget_getaddr function
* from miniwget.c in order to retreive a web ressource using * from miniwget.c in order to retrieve a web ressource using
* a GET HTTP method, and store it in a file. * a GET HTTP method, and store it in a file.
*/ */
int main(int argc, char * * argv) int main(int argc, char * * argv)

View File

@ -8,7 +8,7 @@
# #
# This test program : # This test program :
# 1 - launches a local HTTP server (minihttptestserver) # 1 - launches a local HTTP server (minihttptestserver)
# 2 - uses testminiwget to retreive data from this server # 2 - uses testminiwget to retrieve data from this server
# 3 - compares served and received data # 3 - compares served and received data
# 4 - kills the local HTTP server and exits # 4 - kills the local HTTP server and exits
# #

View File

@ -93,7 +93,7 @@ VERSION 2.0 : released on 2016/04/19
2015/09/22: 2015/09/22:
cleanup UPNP_VERSION macro / add UPNP_VERSION_MAJOR, UPNP_VERSION_MINOR cleanup UPNP_VERSION macro / add UPNP_VERSION_MAJOR, UPNP_VERSION_MINOR
Dont use packed structs anymore to read/write PCP messages Don't use packed structs anymore to read/write PCP messages
2015/09/15: 2015/09/15:
use name server from query in SOAP responses use name server from query in SOAP responses
@ -316,7 +316,7 @@ VERSION 1.8 : released on 2013/02/06
2013/02/06: 2013/02/06:
Check source address of incomining HTTP connections and SSDP Check source address of incomining HTTP connections and SSDP
packets in order to filter out WAN SSDP and HTTP trafic. packets in order to filter out WAN SSDP and HTTP traffic.
Implement get_src_for_route_to() for *BSD Implement get_src_for_route_to() for *BSD
fix 2 potential memory leaks in GetListOfPortMappings() fix 2 potential memory leaks in GetListOfPortMappings()
@ -601,7 +601,7 @@ VERSION 1.6 : released the 2011/07/25
GET /DP.xml is now available. The description has to be completed. GET /DP.xml is now available. The description has to be completed.
2011/05/19: 2011/05/19:
Add getconnstatus.c/.h. Dont always have ConnectionStatus to "Connected" Add getconnstatus.c/.h. Don't always have ConnectionStatus to "Connected"
Events for WANIPv6FirewallControll Events for WANIPv6FirewallControll
2011/05/16: 2011/05/16:

View File

@ -25,7 +25,7 @@ To Build and Install :
lines to /etc/pf.conf : lines to /etc/pf.conf :
pass out on $int_if from any to 239.0.0.0/8 keep state pass out on $int_if from any to 239.0.0.0/8 keep state
pass in on $int_if from any to 239.0.0.0/8 keep state pass in on $int_if from any to 239.0.0.0/8 keep state
- dont forget to " pfctl -f /etc/pf.conf " - don't forget to " pfctl -f /etc/pf.conf "
- you can check your modifications are taken into account with - you can check your modifications are taken into account with
"pfctl -s nat" and "pfctl -s rule". Look for the "rdr-anchor miniupnpd" "pfctl -s nat" and "pfctl -s rule". Look for the "rdr-anchor miniupnpd"
(if applicable) and/or "anchor miniupnpd" lines. (if applicable) and/or "anchor miniupnpd" lines.
@ -75,7 +75,7 @@ To Build and install :
from http://netfilter.org from http://netfilter.org
- edit and run netfilter/iptables_init.sh shell script. - edit and run netfilter/iptables_init.sh shell script.
This script must allways be run before the daemon This script must allways be run before the daemon
to set up intial rules and chains. to set up initial rules and chains.
- Build and edit the config.h file - Build and edit the config.h file
> make -f Makefile.linux config.h > make -f Makefile.linux config.h
> vi config.h > vi config.h
@ -90,8 +90,8 @@ To Build and install :
- anytime, you can use the netfilter/iptables_flush.sh - anytime, you can use the netfilter/iptables_flush.sh
script to flush all rules added by the daemon. script to flush all rules added by the daemon.
- after killing the daemon, you can get back to - after killing the daemon, you can get back to
iptables initial state by runing the netfilter/iptables_removeall.sh iptables initial state by running the netfilter/iptables_removeall.sh
script. Don't forget to edit the script to your convinience. script. Don't forget to edit the script to your convenience.
NOTE: a /etc/init.d/miniupnpd script will be installed. NOTE: a /etc/init.d/miniupnpd script will be installed.
If it suits you, you can use is with start, stop or restart argument. If it suits you, you can use is with start, stop or restart argument.

View File

@ -619,7 +619,7 @@ cat >> ${CONFIGFILE} <<EOF
/* With the following macro defined, a random string is prepended to all URLs */ /* With the following macro defined, a random string is prepended to all URLs */
/*#define RANDOMIZE_URLS*/ /*#define RANDOMIZE_URLS*/
/* maximum lenght of SSDP packets we are generating /* maximum length of SSDP packets we are generating
* (reception is done in a 1500byte buffer) */ * (reception is done in a 1500byte buffer) */
#define SSDP_PACKET_MAX_LEN 1024 #define SSDP_PACKET_MAX_LEN 1024

View File

@ -324,7 +324,7 @@ ProcessInterfaceWatchNotify(int s)
{ {
struct ifa_cacheinfo *cache_info; struct ifa_cacheinfo *cache_info;
cache_info = RTA_DATA(rth); cache_info = RTA_DATA(rth);
snprintf(tmp, sizeof(tmp), "valid=%u prefered=%u", snprintf(tmp, sizeof(tmp), "valid=%u preferred=%u",
cache_info->ifa_valid, cache_info->ifa_prefered); cache_info->ifa_valid, cache_info->ifa_prefered);
} }
break; break;

View File

@ -190,7 +190,7 @@ OpenAndConfSSDPReceiveSocket(int ipv6)
struct sockaddr_in * saddr = (struct sockaddr_in *)&sockname; struct sockaddr_in * saddr = (struct sockaddr_in *)&sockname;
saddr->sin_family = AF_INET; saddr->sin_family = AF_INET;
saddr->sin_port = htons(SSDP_PORT); saddr->sin_port = htons(SSDP_PORT);
/* NOTE : it seems it doesnt work when binding on the specific address */ /* NOTE : it seems it doesn't work when binding on the specific address */
/*saddr->sin_addr.s_addr = inet_addr(UPNP_MCAST_ADDR);*/ /*saddr->sin_addr.s_addr = inet_addr(UPNP_MCAST_ADDR);*/
saddr->sin_addr.s_addr = htonl(INADDR_ANY); saddr->sin_addr.s_addr = htonl(INADDR_ANY);
/*saddr->sin_addr.s_addr = inet_addr(ifaddr);*/ /*saddr->sin_addr.s_addr = inet_addr(ifaddr);*/

View File

@ -35,7 +35,7 @@ POSSIBILITY OF SUCH DAMAGE.
- IPv6 is always firewalled (this may need some work, NAT6* do exist) - IPv6 is always firewalled (this may need some work, NAT6* do exist)
- we make the judgement based on (in order, picking first one available): - we make the judgement based on (in order, picking first one available):
- third party adress - third party address
- internal client address - internal client address
TODO : handle NAT46, NAT64, NPT66. In addition, beyond FW/NAT TODO : handle NAT46, NAT64, NPT66. In addition, beyond FW/NAT

View File

@ -80,7 +80,7 @@ int test(void)
if(now.tv_sec > next_send.tv_sec || if(now.tv_sec > next_send.tv_sec ||
(now.tv_sec == next_send.tv_sec && now.tv_usec >= next_send.tv_usec)) { (now.tv_sec == next_send.tv_sec && now.tv_usec >= next_send.tv_usec)) {
if(i > 0) { if(i > 0) {
/* dont wait */ /* don't wait */
timeout.tv_sec = 0; timeout.tv_sec = 0;
} else { } else {
/* wait 10sec :) */ /* wait 10sec :) */

View File

@ -14,7 +14,7 @@
#include "miniupnpdtypes.h" #include "miniupnpdtypes.h"
#include "config.h" #include "config.h"
/* name of the network interface used to acces internet */ /* name of the network interface used to access internet */
extern const char * ext_if_name; extern const char * ext_if_name;
/* file to store all leases */ /* file to store all leases */

View File

@ -762,7 +762,7 @@ ProcessHttpQuery_upnphttp(struct upnphttp * h)
p = h->req_buf; p = h->req_buf;
if(!p) if(!p)
return; return;
/* note : checking (*p != '\r') is enough to avoid runing off the /* note : checking (*p != '\r') is enough to avoid running off the
* end of the buffer, because h->req_buf is guaranteed to contain * end of the buffer, because h->req_buf is guaranteed to contain
* the \r\n\r\n character sequence */ * the \r\n\r\n character sequence */
for(i = 0; i<15 && *p != ' ' && *p != '\r'; i++) for(i = 0; i<15 && *p != ' ' && *p != '\r'; i++)
@ -1216,7 +1216,7 @@ SendResp_upnphttp(struct upnphttp * h)
} else { } else {
#endif #endif
if(errno == EINTR) if(errno == EINTR)
continue; /* try again immediatly */ continue; /* try again immediately */
if(errno == EAGAIN || errno == EWOULDBLOCK) if(errno == EAGAIN || errno == EWOULDBLOCK)
{ {
/* try again later */ /* try again later */
@ -1278,7 +1278,7 @@ SendRespAndClose_upnphttp(struct upnphttp * h)
} else { } else {
#endif #endif
if(errno == EINTR) if(errno == EINTR)
continue; /* try again immediatly */ continue; /* try again immediately */
if(errno == EAGAIN || errno == EWOULDBLOCK) if(errno == EAGAIN || errno == EWOULDBLOCK)
{ {
/* try again later */ /* try again later */

View File

@ -277,7 +277,7 @@ int reload_from_lease_file()
#endif #endif
/* upnp_redirect() /* upnp_redirect()
* calls OS/fw dependant implementation of the redirection. * calls OS/fw dependent implementation of the redirection.
* protocol should be the string "TCP" or "UDP" * protocol should be the string "TCP" or "UDP"
* returns: 0 on success * returns: 0 on success
* -1 failed to redirect * -1 failed to redirect
@ -425,7 +425,7 @@ upnp_redirect_internal(const char * rhost, unsigned short eport,
/* Firewall independant code which call the FW dependant code. */ /* Firewall independent code which call the FW dependent code. */
int int
upnp_get_redirection_infos(unsigned short eport, const char * protocol, upnp_get_redirection_infos(unsigned short eport, const char * protocol,
unsigned short * iport, unsigned short * iport,

View File

@ -18,7 +18,7 @@ int reload_from_lease_file(void);
#endif #endif
/* upnp_redirect() /* upnp_redirect()
* calls OS/fw dependant implementation of the redirection. * calls OS/fw dependent implementation of the redirection.
* protocol should be the string "TCP" or "UDP" * protocol should be the string "TCP" or "UDP"
* returns: 0 on success * returns: 0 on success
* -1 failed to redirect * -1 failed to redirect

View File

@ -1370,7 +1370,7 @@ QueryStateVariable(struct upnphttp * h, const char * action, const char * ns)
BuildSendAndCloseSoapResp(h, body, bodylen); BuildSendAndCloseSoapResp(h, body, bodylen);
} }
#if 0 #if 0
/* not usefull */ /* not useful */
else if(strcmp(var_name, "ConnectionType") == 0) else if(strcmp(var_name, "ConnectionType") == 0)
{ {
bodylen = snprintf(body, sizeof(body), resp, "IP_Routed"); bodylen = snprintf(body, sizeof(body), resp, "IP_Routed");