diff --git a/Changelog.txt b/Changelog.txt deleted file mode 100644 index 42af405..0000000 --- a/Changelog.txt +++ /dev/null @@ -1,433 +0,0 @@ -$Id$ - -2008/07/10: - Fixed compilation without ENABLE_L3F_SERVICE - -2008/04/27: - correct UNSUBSCRIBE processing - -2008/04/25(bis): - changed iptables_removeall.sh and iptables_init.sh in order - to remove IP from the rules - -VERSION 1.1 : -2008/04/25: - Eventing is allmost completly implemented - -2008/04/24: - Correct event handling ? - -2008/04/08: - enabling tag in PF rules. quick can be set off. - -2008/03/13: - implementing event notify - -2008/03/11: - fixing a command line parsing error - -2008/03/09: - optimisations in upnpsoap.c - -2008/03/08: - optimizing upnpsoap.c for size - -2008/03/06: - Worked on the Eventing : generating XML event notifications - Send initial notification after subscribe - Improved pretty print of testupnpdescgen - Reduced Memory usage of upnpdescgen - fixed a small bug in the description - -2008/03/03: - Fixed miniupnpd.c for compiling without natpmp support - fixed presentationURL not there with L3F - fixing lease file creation/modification - -2008/02/25: - Rewrite of Send501() and Send404() - More work on events - genconfig.sh autodetects pf/ipf - -2008/02/24: - Started to implement UPnP Events. do NOT use it at the moment ! - -2008/02/21: - Added support for the Layer3Forwarding Service - added init_redirect() and shutdown_redirect() functions - -2008/02/20: - Removed Ext: HTTP header when useless - enabled the dummy service by default to please windows XP ! - -2008/02/07: - upnp_enable patch by Nikos Mavrogiannopoulos. - lease_file patch by Nikos Mavrogiannopoulos. - -2008/01/29: - some changes to Makefile.openwrt - use daemon() - daemonize() is still available for systems lacking daemon() - -VERSION 1.0 : -2008/01/27: - moved lan_addr to upnpglobalvars.h/.c - Adding experimental multiple external IP support. - -2008/01/22: - removed dummy service from description to improve compatibility - with emule client - Add "secure mode". put runtime flags in the same variable - -2008/01/14: - Fixed a bug in options.c for the parsing of empty lines. - -2008/01/03: - Fixed CleanExpiredNATPMP() - -2008/01/02: - Adding a queue parameter for setting ALTQ in pf - -2007/12/27: - improving some stuff with the PF_ENABLE_FILTER_RULE. - -2007/12/22: - Adding a runtime option to enable/disable NAT-PMP - -2007/12/20: - Added a cache in linux getifstats(). Please enable by editing config.h - -2007/12/14: - Updating an existing NAT-PMP mapping now works - -2007/12/13: - NAT-PMP code now remove expired mappings - TCP/UDP where swapped in NAT-PMP code - -2007/12/04: - Adding details to the error message for sendto(udp_notify) - -2007/11/27: - pf code doesn't generate filter rules by default anymore. The - #ifdef PF_ENABLE_FILTER_RULES must be uncommented in config.h. - -2007/11/02: - moved some of the prototypes common to all firewalls to commonrdr.h - Added functionalities to NAT-PMP - -2007/11/01: - Debugged NAT-PMP code - -2007/10/28: - Cleaning and improving NAT-PMP code - -2007/10/25: - improved the NAT-PMP experimental support - updated README and INSTALL files - -2007/10/24: - Adding support for NAT-PMP (from apple !) - -2007/10/11: - Checking the commandline for errors. - -2007/10/08: - Improved the BSD/Solaris Makefile - Merging last code from Darren Reed. Solaris/IPF should work now ! - added a man page. - -2007/10/07: - Adding Darren Reed code for ipf. - -2007/10/06: - Adding SunOS support thanks to Darren Reed. - Reorganizing os/firewall dependent code thanks to Darren Reed. - -2007/09/27: - linux make install support PREFIX variable - -2007/09/25: - reorganizing LAN sockets/address to improve multi LAN support. - SSDP announces are sent to all configured networks. - SSDP responses are "customized" by subnetwork. - -2007/09/24: - prototype code to remove unused rules - miniupnpdctl now display current rules - synchronised add_filter_rule2() prototype between pf and netfilter code. - -2007/09/19: - Correctly filling the Cache-control header in SSDP packets - -2007/08/28: - update PFRULE_INOUT_COUNTS detection for FreeBSD - -2007/08/27: - update version in genconfig.sh - do not error when a duplicate redirection is requested. - -2007/07/16: - really fixed the compilation bug with linux>=2.6.22 - -2007/07/04: - fixed an error in options.c that prevented to use packet_log option - -2007/07/03: - improved genconfig.sh - fixed a compilation bug with linux>=2.6.22 - -2007/06/22: - added PFRULE_INOUT_COUNTS macro to enable separate in/out packet and - bytes counts in pf for OpenBSD >= 3.8 - -2007/06/15: - removed a possible racecondition in writepidfile() - -2007/06/12: - improved genconfig.sh : no more "echo -e", use lsb_release when available - -2007/06/11: - get_redirect_rule*() functions now return some statistics about - rule usage (bytes and packets) - -2007/06/07: - Fixed the get_redirect_desc() in the linux/netfilter code - -2007/06/05: - Clean up init code in miniupnpd.c - Added a syslog message in SoapError() - -2007/06/04: - Now store redirection descriptions in the linux/netfilter code - -2007/05/21: - Answers to SSDP M-SEARCH requests with ST: ssdp:all - added make install to Makefile.linux - -2007/05/10: - Fixed a bug int the DeletePortMapping linux/netfilter implementation - It was allways the 1st rule that was deleted. - -2007/04/26: - Fixed config.h.openwrt - -2007/04/16: - added something in the INSTALL file about the FreeBSD send(udp_notify) - problem fix (allowing 239.0.0.0/8 explicitely in pf.conf) - -2007/03/30: - added setsockopt(s, SOL_SOCKET, SO_BROADCAST ...) for broadcasting - socket - -2007/03/17: - Fixed filter rule under linux : it was using wrong port ! - thanks to Wesley W. Terpstra - -2007/03/01: - Moved some of the SSDP code from miniupnpd.c to minissdp.c - -2007/02/28: - creating miniupnpdctl - -2007/02/26: - use LOG_MINIUPNPD macro for openlog() - simplify miniupndShutdown() - -2007/02/09: - improved genconfig.h - Added stuff to change the pf rule "rdr" to "rdr pass" - -2007/02/07: - Corrected Bytes per seconds to bits per second. - Ryan cleaned up comments and typos. - Ryan cleaned up daemonize stuff. - Ryan added possibility to configure model number and serial number - -2007/01/30: - ryan improved the robustness of most UPnP Soap methods - I added a target in the Makefiles to properly generate an uuid using - command line tools. - Improved configuration file parsing. - -2007/01/29: - Adding uuid option in miniupnpd.conf - -2007/01/27: - Added upnppermissions stuff : adding some security to UPnP ! - fixed XML description thanks to Ryan Wagoner - improved QueryStateVariable thanks to Ryan Wagoner - -2007/01/22: - use getifaddr() for each GetExtenalIPAddress() Call. - We can change the ip during execution without pb - -2007/01/17: - Lots of code cleanup - -2007/01/12: - Fixed a nasty bug in the linux/netfilter version of get_filter_rule() - -2007/01/11: - Improved the handling of the miniupnpd.conf file. - added -f option to choose which config file to read. - -2007/01/10: - Fixed potential bugs with ClearNameValueList() - -2007/01/08: - All by Ryan Wagoner : - - coding style and comments cleanup - - using now option file miniupnpd.conf - -2007/01/03: - changed "xx active incoming HTTP connections" msg - -2007/01/02: - Patch from Ryan Wagoner : - - no need to open sockets if we can't set the error handlers - - format the usage so it fits nicely on a standard size terminal - - fix up log_err message so they have the same format and you know what - they are related to - - use same "white space" style throughout - - on shutdown no need to continue if opening socket or setsockopt fails - -2006/12/14: - reduce amount of log lines (keeping the same information) - -2006/12/07: - Fixed Makefiles - fixed typos in logs - version 1.0-RC1 released - -2006/12/02: - moved strings from upnpdescgen.c to upnpdescstrings.h for - easier modification - Server: HTTP header now comes from a #define - added a compilation-time generated config.h - -2006/11/30: - 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 - -2006/11/26: - no need to have miniupnpc sources to compile miniupnpd. - Makefile.openwrt updated - Closing sockets on exit thanks to Ryan Wagoner - -2006/11/23: - now handling signal SIGINT - setting HTTP socket with REUSEADDR thanks to Ryan Wagoner - daemon now tested on a Linksys WRT54G device running OpenWRT ! - -2006/11/21: - disabling rtableid in pf code. - -2006/11/22: - Also responds on M-SEARCH with the uuid - -2006/11/20: - gaining some space in upnpsoap.c - -2006/11/19: - Cleaning up code to comply with ANSI C89 - -2006/11/17: - Linux version now deleting both nat and accept rules - implemented -U option under Linux - -2006/11/16: - implemented delete_redirect_rule() for linux - returning error 714 in DeletePortMapping() when needed - -2006/11/12: - The linux/netfilter version should now WORK ! - fix in the writepidfile() function. open with a mode ! - -2006/11/10: - fixing the XML description generation for big endian machines - working on the linux/netfilter port - -2006/11/09: - improved a lot the handling of HTTP error cases - -2006/11/08: - Tried to make the Makefile compatible with both BSDmake - and GNUmake. It was hard because of $^ and $< - -2006/11/07: - Makefile compatible with BSD make - make install target. - getifstats.c compatible with both OpenBSD and FreeBSD. - -2006/11/06: - added getifstats.c for openBSD. May not work under FreeBSD ? - now reports bytes/packets sent/received - reporting bitrates - possibility to report system uptime - -2006/10/29: - added a -L option to enable loggin (is off by default now). - -2006/10/28: - Patch by Ryan Wagoner to correct the XML description (was NewUpTime - instead of NewUptime) and implement uptime. - Trying to fix the memory leak. Added some comments - added a -d option for debugging purpose - Tnaks to valgrind (under linux!) I removed a small memory access error. - -2006/10/27: - Thanks to a patch sent by Michael van Tellingen, miniupnpd is - now ignoring NOTIFY packets sent by other devices and is - writing is own pid to /var/run/miniupnpd.pid - -2006/10/23: - Allways set sendEvents="no" in XML description (was causing - pb with winXP as SUBSCRIBE is not implemented) - -2006/10/22: - added translation from hostname to IP in the AddPortMapping() method - Thanks to Ryan Wagoner. - -2006/10/18: - Added an INSTALL file - -2006/10/13: - Added the possibility to change the notify interval - -2006/09/29: - Improved compliance of the XML Descriptions - pretty print for testupnpdescgen - -2006/09/25: - improved the Error 404 response. - Better serviceType and serviceId for dummy service... - -2006/09/24: - updating the XML description generator - -2006/09/18: - Thanks to Rick Richard, support for SSDP "alive" and "byebye" notifications - was added. The -u options was also added. The SSDP response are now - improved. - The -o option is now working (to force a specific external IP address). - The Soap Methods errors are correctly responded (401 Invalid Action) - -2006/09/09: - Added code to handle filter rules. Thanks to Seth Mos (pfsense.com) - storing the descriptions in the label of the rule - -2006/09/02: - improved the generation of the XML descriptions. - I still need to add allowed values to variables. - -2006/07/29: - filtering SSDP requests and responding with same ST: field - -2006/07/25: - Added a dummy description for the WANDevice - -2006/07/20: - Command line arguments processing - Added possibility to listen internally on several interfaces - diff --git a/genconfig.sh b/genconfig.sh index c94d639..7cc647f 100755 --- a/genconfig.sh +++ b/genconfig.sh @@ -105,8 +105,8 @@ case $OS_NAME in # NETGEAR ReadyNAS special case if [ -f /etc/raidiator_version ]; then OS_NAME=$(awk -F'!!|=' '{ print $1 }' /etc/raidiator_version) - OS_VERSION=$(awk -F'!!|[=,]' '{ print $3 }' /etc/raidiator_version) - OS_URL=http://www.readynas.com/ + OS_VERSION=$(awk -F'!!|[=,.]' '{ print $3"."$4 }' /etc/raidiator_version) + OS_URL="http://www.readynas.com/" DB_PATH="/var/cache/minidlna" TIVO="#define TIVO_SUPPORT" READYNAS="#define READYNAS" diff --git a/minidlnapath.h b/minidlnapath.h index 1a2bd7a..58656f4 100644 --- a/minidlnapath.h +++ b/minidlnapath.h @@ -4,8 +4,8 @@ * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ -#ifndef __MINIUPNPDPATH_H__ -#define __MINIUPNPDPATH_H__ +#ifndef __MINIDLNAPATH_H__ +#define __MINIDLNAPATH_H__ #include "config.h" diff --git a/minidlnatypes.h b/minidlnatypes.h index edec0d2..d1e04d9 100644 --- a/minidlnatypes.h +++ b/minidlnatypes.h @@ -3,8 +3,8 @@ * (c) 2006-2007 Thomas Bernard * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ -#ifndef __MINIUPNPDTYPES_H__ -#define __MINIUPNPDTYPES_H__ +#ifndef __MINIDLNATYPES_H__ +#define __MINIDLNATYPES_H__ #include "config.h" #include diff --git a/minissdp.c b/minissdp.c index 589353a..d5d3487 100644 --- a/minissdp.c +++ b/minissdp.c @@ -214,7 +214,7 @@ SendSSDPAnnounce2(int s, struct sockaddr_in sockname, "ST: %.*s%s\r\n" "USN: %s::%.*s%s\r\n" "EXT:\r\n" - "SERVER: " MINIUPNPD_SERVER_STRING "\r\n" + "SERVER: " MINIDLNA_SERVER_STRING "\r\n" "LOCATION: http://%s:%u" ROOTDESC_PATH "\r\n" "Content-Length: 0\r\n" "\r\n", @@ -266,7 +266,7 @@ SendSSDPNotifies(int s, const char * host, unsigned short port, "HOST:%s:%d\r\n" "CACHE-CONTROL:max-age=%u\r\n" "LOCATION:http://%s:%d" ROOTDESC_PATH"\r\n" - "SERVER: " MINIUPNPD_SERVER_STRING "\r\n" + "SERVER: " MINIDLNA_SERVER_STRING "\r\n" "NT:%s%s\r\n" "USN:%s::%s%s\r\n" "NTS:ssdp:alive\r\n" diff --git a/upnpdescgen.c b/upnpdescgen.c index ba7a1e0..1eae2b8 100644 --- a/upnpdescgen.c +++ b/upnpdescgen.c @@ -479,7 +479,6 @@ static const struct argument GetTotalPacketsReceivedArgs[] = static const struct serviceDesc scpdContentDirectory = { ContentDirectoryActions, ContentDirectoryVars }; -//{ ContentDirectoryActions, ContentDirectoryVars }; static const struct serviceDesc scpdConnectionManager = { ConnectionManagerActions, ConnectionManagerVars }; @@ -626,21 +625,12 @@ genRootDesc(int * len) str = (char *)malloc(tmplen); if(str == NULL) return NULL; -#if 1 * len = strlen(xmlver); /*strcpy(str, xmlver); */ memcpy(str, xmlver, *len + 1); str = genXML(str, len, &tmplen, rootDesc); str[*len] = '\0'; return str; -#else -char *ret = calloc(1, 8192); -sprintf(ret, "\r\n" -"10urn:schemas-upnp-org:device:MediaServer:1MiniDLNA (MaggardMachine2)NETGEARhttp://www.netgear.comNETGEAR ReadyNAS NVReadyNASNVhttp://www.netgear.comuuid:aefc3d94-8cf7-11dd-b3bb-ff0d6f9a7e6dDMS-1.50\r\n" -"urn:schemas-upnp-org:service:ConnectionManager:1urn:upnp-org:serviceId:ConnectionManager/ConnectionMgr.xml/ctl/ConnectionMgr/evt/ConnectionMgrurn:schemas-upnp-org:service:ContentDirectory:1urn:upnp-org:serviceId:ContentDirectory/ContentDir.xml/ctl/ContentDir/evt/ContentDir"); - * len = strlen(ret); -return ret; -#endif } /* genServiceDesc() : diff --git a/upnpdescstrings.h b/upnpdescstrings.h index 47e65b7..8f18279 100644 --- a/upnpdescstrings.h +++ b/upnpdescstrings.h @@ -9,14 +9,16 @@ #include "config.h" /* strings used in the root device xml description */ +#define ROOTDEV_MANUFACTURERURL OS_URL #ifdef READYNAS #define ROOTDEV_MANUFACTURER "NETGEAR" +#define ROOTDEV_MODELNAME "Windows Media Connect compatible (ReadyDLNA)" +#define ROOTDEV_MODELDESCRIPTION "ReadyDLNA on ReadyNAS RAIDiator OS" #else #define ROOTDEV_MANUFACTURER "Justin Maggard" +#define ROOTDEV_MODELNAME "Windows Media Connect compatible (MiniDLNA)" +#define ROOTDEV_MODELDESCRIPTION "MiniDLNA on " OS_NAME #endif -#define ROOTDEV_MANUFACTURERURL OS_URL -#define ROOTDEV_MODELNAME "Windows Media Connect compatible (minidlna)" -#define ROOTDEV_MODELDESCRIPTION OS_NAME " *ReadyNAS dev DLNA" #define ROOTDEV_MODELURL OS_URL #endif diff --git a/upnpevents.c b/upnpevents.c index af5d8ab..d140e11 100644 --- a/upnpevents.c +++ b/upnpevents.c @@ -447,7 +447,7 @@ void upnpevents_processfds(fd_set *readset, fd_set *writeset) } } -#ifdef USE_MINIUPNPDCTL +#ifdef USE_MINIDLNACTL void write_events_details(int s) { int n; char buff[80]; diff --git a/upnphttp.c b/upnphttp.c index ec5e42f..0ce62ed 100644 --- a/upnphttp.c +++ b/upnphttp.c @@ -824,13 +824,11 @@ Process_upnphttp(struct upnphttp * h) static const char httpresphead[] = "%s %d %s\r\n" - /*"Content-Type: text/xml; charset=\"utf-8\"\r\n"*/ "Content-Type: %s\r\n" "Connection: close\r\n" "Content-Length: %d\r\n" - /*"Server: miniupnpd/1.0 UPnP/1.0\r\n"*/ + "Server: " MINIDLNA_SERVER_STRING "\r\n" // "Accept-Ranges: bytes\r\n" - //"Server: " MINIUPNPD_SERVER_STRING "\r\n" ; /*"\r\n";*/ /* "\n" @@ -884,9 +882,6 @@ BuildHeader_upnphttp(struct upnphttp * h, int respcode, "SID: %s\r\n", h->req_SID); } #if 0 // DLNA - h->res_buflen += snprintf(h->res_buf + h->res_buflen, - h->res_buf_alloclen - h->res_buflen, - "Server: Microsoft-Windows-NT/5.1 UPnP/1.0 UPnP-Device-Host/1.0\r\n"); char szTime[30]; time_t curtime = time(NULL); strftime(szTime, 30,"%a, %d %b %Y %H:%M:%S GMT" , gmtime(&curtime)); @@ -1046,7 +1041,7 @@ SendResp_icon(struct upnphttp * h, char * icon) "Content-Length: %d\r\n" "Connection: close\r\n" "Date: %s\r\n" - "Server: RAIDiator/4.1, UPnP/1.0, MiniDLNA/1.0\r\n\r\n", + "Server: " MINIDLNA_SERVER_STRING "\r\n\r\n", mime, size, date); if( (send_data(h, header, strlen(header)) == 0) && (h->req_command != EHead) ) @@ -1110,7 +1105,7 @@ SendResp_albumArt(struct upnphttp * h, char * object) "Date: %s\r\n" "EXT:\r\n" "contentFeatures.dlna.org: DLNA.ORG_PN=JPEG_TN\r\n" - "Server: RAIDiator/4.1, UPnP/1.0, MiniDLNA/1.0\r\n", + "Server: " MINIDLNA_SERVER_STRING "\r\n", size, date); if( h->reqflags & FLAG_XFERBACKGROUND ) @@ -1190,7 +1185,7 @@ SendResp_thumbnail(struct upnphttp * h, char * object) "Date: %s\r\n" "EXT:\r\n" "contentFeatures.dlna.org: DLNA.ORG_PN=JPEG_TN\r\n" - "Server: RAIDiator/4.1, UPnP/1.0, MiniDLNA/1.0\r\n", + "Server: " MINIDLNA_SERVER_STRING "\r\n", ed->size, date); if( h->reqflags & FLAG_XFERBACKGROUND ) @@ -1353,7 +1348,7 @@ SendResp_resizedimg(struct upnphttp * h, char * object) "Date: %s\r\n" "EXT:\r\n" "contentFeatures.dlna.org: DLNA.ORG_PN=JPEG_TN\r\n" - "Server: RAIDiator/4.1, UPnP/1.0, MiniDLNA_TN/1.0\r\n", + "Server: " MINIDLNA_SERVER_STRING "\r\n", h->HttpVer, size, date); if( h->reqflags & FLAG_XFERINTERACTIVE ) @@ -1550,7 +1545,7 @@ SendResp_dlnafile(struct upnphttp * h, char * object) "Date: %s\r\n" "EXT:\r\n" "contentFeatures.dlna.org: DLNA.ORG_PN=%s\r\n" - "Server: RAIDiator/4.1, UPnP/1.0, MiniDLNA/1.0\r\n\r\n", + "Server: " MINIDLNA_SERVER_STRING "\r\n\r\n", date, last_file.dlna); strcat(header, hdr_buf); diff --git a/upnphttp.h b/upnphttp.h index 0aa9f98..f6ac09c 100644 --- a/upnphttp.h +++ b/upnphttp.h @@ -14,7 +14,7 @@ #include "config.h" /* server: HTTP header returned in all HTTP responses : */ -#define MINIUPNPD_SERVER_STRING OS_VERSION " UPnP/1.0 miniupnpd/1.0" +#define MINIDLNA_SERVER_STRING OS_VERSION " UPnP/1.0 MiniDLNA/1.0" /* states : diff --git a/upnpreplyparse.c b/upnpreplyparse.c index 4ec9a5d..eef1c44 100644 --- a/upnpreplyparse.c +++ b/upnpreplyparse.c @@ -81,31 +81,6 @@ GetValueFromNameValueList(struct NameValueParserData * pdata, return p; } -#if 0 -/* useless now that minixml ignores namespaces by itself */ -char * -GetValueFromNameValueListIgnoreNS(struct NameValueParserData * pdata, - const char * Name) -{ - struct NameValue * nv; - char * p = NULL; - char * pname; - for(nv = pdata->head.lh_first; - (nv != NULL) && (p == NULL); - nv = nv->entries.le_next) - { - pname = strrchr(nv->name, ':'); - if(pname) - pname++; - else - pname = nv->name; - if(strcmp(pname, Name)==0) - p = nv->value; - } - return p; -} -#endif - /* debug all-in-one function * do parsing then display to stdout */ #ifdef DEBUG diff --git a/upnpsoap.c b/upnpsoap.c index 62c75c8..a4b5932 100644 --- a/upnpsoap.c +++ b/upnpsoap.c @@ -1036,19 +1036,6 @@ QueryStateVariable(struct upnphttp * h, const char * action) "Connected", action); BuildSendAndCloseSoapResp(h, body, bodylen); } -#if 0 - /* not useful */ - 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); - } -#endif else { DPRINTF(E_WARN, L_HTTP, "%s: Unknown: %s\n", action, var_name?var_name:"");