miniupnpd: Make all manufacturer info configurable

This commit is contained in:
Thomas Bernard 2013-12-13 12:03:28 +01:00
parent cfaeea97bd
commit d19048ef9e
12 changed files with 52 additions and 14 deletions

2
README
View File

@ -42,4 +42,4 @@ Thanks to :
* Chiaki Ishikawa * Chiaki Ishikawa
* Jardel Weyrich * Jardel Weyrich
* Leah X. Schmidt * Leah X. Schmidt
* Leo Moll

View File

@ -1,5 +1,8 @@
$Id: Changelog.txt,v 1.345 2013/06/13 13:21:28 nanard Exp $ $Id: Changelog.txt,v 1.345 2013/06/13 13:21:28 nanard Exp $
2013/12/13:
Make all manufacturer info configurable thanks to Leo Moll
2013/06/13: 2013/06/13:
Have 3 UUID for the 3 devices (IGD, WAN Device, WAN Connection Device) Have 3 UUID for the 3 devices (IGD, WAN Device, WAN Connection Device)

View File

@ -2,7 +2,7 @@
# $Id: genconfig.sh,v 1.63 2013/05/03 09:30:10 nanard Exp $ # $Id: genconfig.sh,v 1.63 2013/05/03 09:30:10 nanard Exp $
# miniupnp daemon # miniupnp daemon
# http://miniupnp.free.fr or http://miniupnp.tuxfamily.org/ # http://miniupnp.free.fr or http://miniupnp.tuxfamily.org/
# (c) 2006-2012 Thomas Bernard # (c) 2006-2013 Thomas Bernard
# This software is subject to the conditions detailed in the # This software is subject to the conditions detailed in the
# LICENCE file provided within the distribution # LICENCE file provided within the distribution
@ -81,7 +81,7 @@ ${RM} ${CONFIGFILE}
echo "/* MiniUPnP Project" >> ${CONFIGFILE} echo "/* MiniUPnP Project" >> ${CONFIGFILE}
echo " * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/" >> ${CONFIGFILE} echo " * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/" >> ${CONFIGFILE}
echo " * (c) 2006-2012 Thomas Bernard" >> ${CONFIGFILE} echo " * (c) 2006-2013 Thomas Bernard" >> ${CONFIGFILE}
echo " * generated by $0 on `date`" >> ${CONFIGFILE} echo " * generated by $0 on `date`" >> ${CONFIGFILE}
echo " * using command line options $* */" >> ${CONFIGFILE} echo " * using command line options $* */" >> ${CONFIGFILE}
echo "#ifndef $CONFIGMACRO" >> ${CONFIGFILE} echo "#ifndef $CONFIGMACRO" >> ${CONFIGFILE}
@ -460,6 +460,10 @@ echo "/* disable reading and parsing of config file (miniupnpd.conf) */" >> ${CO
echo "/*#define DISABLE_CONFIG_FILE*/" >> ${CONFIGFILE} echo "/*#define DISABLE_CONFIG_FILE*/" >> ${CONFIGFILE}
echo "" >> ${CONFIGFILE} echo "" >> ${CONFIGFILE}
echo "/* Unable the ability to configure all manufacturer infos through miniupnpd.conf */" >> ${CONFIGFILE}
echo "/*#define ENABLE_MANUFACTURER_INFO_CONFIGURATION*/" >> ${CONFIGFILE}
echo "" >> ${CONFIGFILE}
echo "#endif" >> ${CONFIGFILE} echo "#endif" >> ${CONFIGFILE}
${MV} ${CONFIGFILE} ${CONFIGFILE_FINAL} ${MV} ${CONFIGFILE} ${CONFIGFILE_FINAL}

View File

@ -778,6 +778,7 @@ init(int argc, char * * argv, struct runtime_vars * v)
case UPNPPRESENTATIONURL: case UPNPPRESENTATIONURL:
presurl = ary_options[i].value; presurl = ary_options[i].value;
break; break;
#ifdef ENABLE_MANUFACTURER_INFO_CONFIGURATION
case UPNPFRIENDLY_NAME: case UPNPFRIENDLY_NAME:
strncpy(friendly_name, ary_options[i].value, FRIENDLY_NAME_MAX_LEN); strncpy(friendly_name, ary_options[i].value, FRIENDLY_NAME_MAX_LEN);
friendly_name[FRIENDLY_NAME_MAX_LEN-1] = '\0'; friendly_name[FRIENDLY_NAME_MAX_LEN-1] = '\0';
@ -802,6 +803,7 @@ init(int argc, char * * argv, struct runtime_vars * v)
strncpy(model_url, ary_options[i].value, MODEL_URL_MAX_LEN); strncpy(model_url, ary_options[i].value, MODEL_URL_MAX_LEN);
model_url[MODEL_URL_MAX_LEN-1] = '\0'; model_url[MODEL_URL_MAX_LEN-1] = '\0';
break; break;
#endif
#ifdef USE_NETFILTER #ifdef USE_NETFILTER
case UPNPFORWARDCHAIN: case UPNPFORWARDCHAIN:
miniupnpd_forward_chain = ary_options[i].value; miniupnpd_forward_chain = ary_options[i].value;
@ -947,6 +949,7 @@ init(int argc, char * * argv, struct runtime_vars * v)
} else } else
fprintf(stderr, "Option -%c takes one argument.\n", argv[i][1]); fprintf(stderr, "Option -%c takes one argument.\n", argv[i][1]);
break; break;
#ifdef ENABLE_MANUFACTURER_INFO_CONFIGURATION
case 'z': case 'z':
if(i+1 < argc) if(i+1 < argc)
strncpy(friendly_name, argv[++i], FRIENDLY_NAME_MAX_LEN); strncpy(friendly_name, argv[++i], FRIENDLY_NAME_MAX_LEN);
@ -954,6 +957,7 @@ init(int argc, char * * argv, struct runtime_vars * v)
fprintf(stderr, "Option -%c takes one argument.\n", argv[i][1]); fprintf(stderr, "Option -%c takes one argument.\n", argv[i][1]);
friendly_name[FRIENDLY_NAME_MAX_LEN-1] = '\0'; friendly_name[FRIENDLY_NAME_MAX_LEN-1] = '\0';
break; break;
#endif
case 's': case 's':
if(i+1 < argc) if(i+1 < argc)
strncpy(serialnumber, argv[++i], SERIALNUMBER_MAX_LEN); strncpy(serialnumber, argv[++i], SERIALNUMBER_MAX_LEN);
@ -1281,7 +1285,10 @@ print_usage:
"\n" "\n"
/*"[-l logfile] " not functionnal */ /*"[-l logfile] " not functionnal */
"\t\t[-u uuid] [-s serial] [-m model_number] \n" "\t\t[-u uuid] [-s serial] [-m model_number] \n"
"\t\t[-t notify_interval] [-P pid_filename] [-z fiendly_name]\n" "\t\t[-t notify_interval] [-P pid_filename] "
#ifdef ENABLE_MANUFACTURER_INFO_CONFIGURATION
"[-z fiendly_name]\n"
#endif
"\t\t[-B down up] [-w url] [-r clean_ruleset_interval]\n" "\t\t[-B down up] [-w url] [-r clean_ruleset_interval]\n"
#ifdef USE_PF #ifdef USE_PF
"\t\t[-q queue] [-T tag]\n" "\t\t[-q queue] [-T tag]\n"

View File

@ -44,23 +44,26 @@ max_lifetime=86400
# lease file location # lease file location
#lease_file=/var/log/upnp.leases #lease_file=/var/log/upnp.leases
# to enable the next few runtime options, see compile time
# ENABLE_MANUFACTURER_INFO_CONFIGURATION (config.h)
# name of this service, default is "`uname -s` router" # name of this service, default is "`uname -s` router"
#friendly_name=MiniUPnPd router #friendly_name=MiniUPnPd router
# manufacturer name, default is "`uname -s`" # manufacturer name, default is "`uname -s`"
#manufacturer_name=ACME Inc. #manufacturer_name=Manufacturer corp
# manufacturer url, default is URL of OS verndor # manufacturer url, default is URL of OS verndor
#manufacturer_url=http://www.acme.com #manufacturer_url=http://miniupnp.free.fr/
# model name, default is "`uname -s` router" # model name, default is "`uname -s` router"
#model_name=VSR-3030 #model_name=Router Model
# model description, default is "`uname -s` router" # model description, default is "`uname -s` router"
#model_description=Very Secure Router - Model 3030 #model_description=Very Secure Router - Model
# model url, default is URL of OS verndor # model url, default is URL of OS vendor
#model_url=http://www.acme.com/products/vsr3030 #model_url=http://miniupnp.free.fr/
# bitrates reported by daemon in bits per second # bitrates reported by daemon in bits per second
bitrate_up=1000000 bitrate_up=1000000

View File

@ -2,7 +2,7 @@
/* MiniUPnP project /* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* author: Ryan Wagoner * author: Ryan Wagoner
* (c) 2006-2012 Thomas Bernard * (c) 2006-2013 Thomas Bernard
* This software is subject to the conditions detailed * This software is subject to the conditions detailed
* in the LICENCE file provided within the distribution */ * in the LICENCE file provided within the distribution */
@ -35,12 +35,14 @@ static const struct {
{ UPNPBITRATE_UP, "bitrate_up" }, { UPNPBITRATE_UP, "bitrate_up" },
{ UPNPBITRATE_DOWN, "bitrate_down" }, { UPNPBITRATE_DOWN, "bitrate_down" },
{ UPNPPRESENTATIONURL, "presentation_url" }, { UPNPPRESENTATIONURL, "presentation_url" },
#ifdef ENABLE_MANUFACTURER_INFO_CONFIGURATION
{ UPNPFRIENDLY_NAME, "friendly_name" }, { UPNPFRIENDLY_NAME, "friendly_name" },
{ UPNPMANUFACTURER_NAME, "manufacturer_name" }, { UPNPMANUFACTURER_NAME, "manufacturer_name" },
{ UPNPMANUFACTURER_URL, "manufacturer_url" }, { UPNPMANUFACTURER_URL, "manufacturer_url" },
{ UPNPMODEL_NAME, "model_name" }, { UPNPMODEL_NAME, "model_name" },
{ UPNPMODEL_DESCRIPTION, "model_description" }, { UPNPMODEL_DESCRIPTION, "model_description" },
{ UPNPMODEL_URL, "model_url" }, { UPNPMODEL_URL, "model_url" },
#endif
{ UPNPNOTIFY_INTERVAL, "notify_interval" }, { UPNPNOTIFY_INTERVAL, "notify_interval" },
{ UPNPSYSTEM_UPTIME, "system_uptime" }, { UPNPSYSTEM_UPTIME, "system_uptime" },
{ UPNPPACKET_LOG, "packet_log" }, { UPNPPACKET_LOG, "packet_log" },

View File

@ -2,7 +2,7 @@
/* MiniUPnP project /* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* author: Ryan Wagoner * author: Ryan Wagoner
* (c) 2006-2012 Thomas Bernard * (c) 2006-2013 Thomas Bernard
* This software is subject to the conditions detailed * This software is subject to the conditions detailed
* in the LICENCE file provided within the distribution */ * in the LICENCE file provided within the distribution */
@ -22,12 +22,14 @@ enum upnpconfigoptions {
UPNPBITRATE_UP, /* "bitrate_up" */ UPNPBITRATE_UP, /* "bitrate_up" */
UPNPBITRATE_DOWN, /* "bitrate_down" */ UPNPBITRATE_DOWN, /* "bitrate_down" */
UPNPPRESENTATIONURL, /* presentation_url */ UPNPPRESENTATIONURL, /* presentation_url */
#ifdef ENABLE_MANUFACTURER_INFO_CONFIGURATION
UPNPFRIENDLY_NAME, /* "friendly_name" */ UPNPFRIENDLY_NAME, /* "friendly_name" */
UPNPMANUFACTURER_NAME, /* "manufacturer_name" */ UPNPMANUFACTURER_NAME, /* "manufacturer_name" */
UPNPMANUFACTURER_URL, /* "manufacturer_url" */ UPNPMANUFACTURER_URL, /* "manufacturer_url" */
UPNPMODEL_NAME, /* "model_name" */ UPNPMODEL_NAME, /* "model_name" */
UPNPMODEL_DESCRIPTION, /* "model_description" */ UPNPMODEL_DESCRIPTION, /* "model_description" */
UPNPMODEL_URL, /* "model_url" */ UPNPMODEL_URL, /* "model_url" */
#endif
UPNPNOTIFY_INTERVAL, /* notify_interval */ UPNPNOTIFY_INTERVAL, /* notify_interval */
UPNPSYSTEM_UPTIME, /* "system_uptime" */ UPNPSYSTEM_UPTIME, /* "system_uptime" */
UPNPPACKET_LOG, /* "packet_log" */ UPNPPACKET_LOG, /* "packet_log" */

View File

@ -25,12 +25,14 @@ char serialnumber[] = "12345678";
char modelnumber[] = "1"; char modelnumber[] = "1";
char presentationurl[] = "http://192.168.0.1:8080/"; char presentationurl[] = "http://192.168.0.1:8080/";
/*char presentationurl[] = "";*/ /*char presentationurl[] = "";*/
#ifdef ENABLE_MANUFACTURER_INFO_CONFIGURATION
char friendly_name[] = OS_NAME " router"; char friendly_name[] = OS_NAME " router";
char manufacturer_name[] = ROOTDEV_MANUFACTURER; char manufacturer_name[] = ROOTDEV_MANUFACTURER;
char manufacturer_url[] = ROOTDEV_MANUFACTURERURL; char manufacturer_url[] = ROOTDEV_MANUFACTURERURL;
char model_name[] = ROOTDEV_MODELNAME; char model_name[] = ROOTDEV_MODELNAME;
char model_description[] = ROOTDEV_MODELDESCRIPTION; char model_description[] = ROOTDEV_MODELDESCRIPTION;
char model_url[] = ROOTDEV_MODELURL; char model_url[] = ROOTDEV_MODELURL;
#endif
char * use_ext_ip_addr = NULL; char * use_ext_ip_addr = NULL;
const char * ext_if_name = "eth0"; const char * ext_if_name = "eth0";

View File

@ -145,6 +145,7 @@ static const struct XMLElt rootDesc[] =
/* 5 */ /* 5 */
{"/deviceType", DEVICE_TYPE_IGD}, {"/deviceType", DEVICE_TYPE_IGD},
/* urn:schemas-upnp-org:device:InternetGatewayDevice:1 or 2 */ /* urn:schemas-upnp-org:device:InternetGatewayDevice:1 or 2 */
#ifdef ENABLE_MANUFACTURER_INFO_CONFIGURATION
{"/friendlyName", friendly_name/*ROOTDEV_FRIENDLYNAME*/}, /* required */ {"/friendlyName", friendly_name/*ROOTDEV_FRIENDLYNAME*/}, /* required */
{"/manufacturer", manufacturer_name/*ROOTDEV_MANUFACTURER*/}, /* required */ {"/manufacturer", manufacturer_name/*ROOTDEV_MANUFACTURER*/}, /* required */
/* 8 */ /* 8 */
@ -153,6 +154,16 @@ static const struct XMLElt rootDesc[] =
{"/modelName", model_name/*ROOTDEV_MODELNAME*/}, /* required */ {"/modelName", model_name/*ROOTDEV_MODELNAME*/}, /* required */
{"/modelNumber", modelnumber}, {"/modelNumber", modelnumber},
{"/modelURL", model_url/*ROOTDEV_MODELURL*/}, {"/modelURL", model_url/*ROOTDEV_MODELURL*/},
#else
{"/friendlyName", ROOTDEV_FRIENDLYNAME}, /* required */
{"/manufacturer", ROOTDEV_MANUFACTURER}, /* required */
/* 8 */
{"/manufacturerURL", ROOTDEV_MANUFACTURERURL}, /* optional */
{"/modelDescription", ROOTDEV_MODELDESCRIPTION}, /* recommended */
{"/modelName", ROOTDEV_MODELNAME}, /* required */
{"/modelNumber", modelnumber},
{"/modelURL", ROOTDEV_MODELURL},
#endif
{"/serialNumber", serialnumber}, {"/serialNumber", serialnumber},
{"/UDN", uuidvalue_igd}, /* required */ {"/UDN", uuidvalue_igd}, /* required */
/* see if /UPC is needed. */ /* see if /UPC is needed. */

View File

@ -1,7 +1,7 @@
/* $Id: upnpdescstrings.h,v 1.8 2012/09/27 16:00:10 nanard Exp $ */ /* $Id: upnpdescstrings.h,v 1.8 2012/09/27 16:00:10 nanard Exp $ */
/* miniupnp project /* miniupnp project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2006-2012 Thomas Bernard * (c) 2006-2013 Thomas Bernard
* This software is subject to the coditions detailed in * This software is subject to the coditions detailed in
* the LICENCE file provided within the distribution */ * the LICENCE file provided within the distribution */
#ifndef UPNPDESCSTRINGS_H_INCLUDED #ifndef UPNPDESCSTRINGS_H_INCLUDED
@ -10,7 +10,7 @@
#include "config.h" #include "config.h"
/* strings used in the root device xml description */ /* strings used in the root device xml description */
/*#define ROOTDEV_FRIENDLYNAME OS_NAME " router"*/ #define ROOTDEV_FRIENDLYNAME OS_NAME " router"
#define ROOTDEV_MANUFACTURER OS_NAME #define ROOTDEV_MANUFACTURER OS_NAME
#define ROOTDEV_MANUFACTURERURL OS_URL #define ROOTDEV_MANUFACTURERURL OS_URL
#define ROOTDEV_MODELNAME OS_NAME " router" #define ROOTDEV_MODELNAME OS_NAME " router"

View File

@ -51,6 +51,7 @@ char modelnumber[MODELNUMBER_MAX_LEN] = "1";
* http://nnn.nnn.nnn.nnn:ppppp/ => max 30 bytes including terminating 0 */ * http://nnn.nnn.nnn.nnn:ppppp/ => max 30 bytes including terminating 0 */
char presentationurl[PRESENTATIONURL_MAX_LEN]; char presentationurl[PRESENTATIONURL_MAX_LEN];
#ifdef ENABLE_MANUFACTURER_INFO_CONFIGURATION
/* friendly name for root devices in XML description */ /* friendly name for root devices in XML description */
char friendly_name[FRIENDLY_NAME_MAX_LEN] = OS_NAME " router"; char friendly_name[FRIENDLY_NAME_MAX_LEN] = OS_NAME " router";
@ -68,6 +69,7 @@ char model_description[MODEL_DESCRIPTION_MAX_LEN] = ROOTDEV_MODELDESCRIPTION;
/* model url for root devices in XML description */ /* model url for root devices in XML description */
char model_url[MODEL_URL_MAX_LEN] = ROOTDEV_MODELURL; char model_url[MODEL_URL_MAX_LEN] = ROOTDEV_MODELURL;
#endif
/* UPnP permission rules : */ /* UPnP permission rules : */
struct upnpperm * upnppermlist = 0; struct upnpperm * upnppermlist = 0;

View File

@ -71,6 +71,7 @@ extern char modelnumber[];
#define PRESENTATIONURL_MAX_LEN (64) #define PRESENTATIONURL_MAX_LEN (64)
extern char presentationurl[]; extern char presentationurl[];
#ifdef ENABLE_MANUFACTURER_INFO_CONFIGURATION
#define FRIENDLY_NAME_MAX_LEN (64) #define FRIENDLY_NAME_MAX_LEN (64)
extern char friendly_name[]; extern char friendly_name[];
@ -88,6 +89,7 @@ extern char model_description[];
#define MODEL_URL_MAX_LEN (64) #define MODEL_URL_MAX_LEN (64)
extern char model_url[]; extern char model_url[];
#endif
/* UPnP permission rules : */ /* UPnP permission rules : */
extern struct upnpperm * upnppermlist; extern struct upnpperm * upnppermlist;