Made all manufacturer related information configurable:

- manufacturer_name, default is "`uname -s`"
- manufacturer_url, default is URL of OS verndor
- model_name, default is "`uname -s` router"
- model_description, default is "`uname -s` router"
- model_url, default is URL of OS verndor
This commit is contained in:
Leo Moll 2013-10-20 23:02:19 +02:00
parent e61a713d02
commit d200fb748f
8 changed files with 88 additions and 6 deletions

View File

@ -782,6 +782,26 @@ init(int argc, char * * argv, struct runtime_vars * v)
strncpy(friendly_name, ary_options[i].value, FRIENDLY_NAME_MAX_LEN);
friendly_name[FRIENDLY_NAME_MAX_LEN-1] = '\0';
break;
case UPNPMANUFACTURER_NAME:
strncpy(manufacturer_name, ary_options[i].value, MANUFACTURER_NAME_MAX_LEN);
manufacturer_name[MANUFACTURER_NAME_MAX_LEN-1] = '\0';
break;
case UPNPMANUFACTURER_URL:
strncpy(manufacturer_url, ary_options[i].value, MANUFACTURER_URL_MAX_LEN);
manufacturer_url[MANUFACTURER_URL_MAX_LEN-1] = '\0';
break;
case UPNPMODEL_NAME:
strncpy(model_name, ary_options[i].value, MODEL_NAME_MAX_LEN);
model_name[MODEL_NAME_MAX_LEN-1] = '\0';
break;
case UPNPMODEL_DESCRIPTION:
strncpy(model_description, ary_options[i].value, MODEL_DESCRIPTION_MAX_LEN);
model_description[MODEL_DESCRIPTION_MAX_LEN-1] = '\0';
break;
case UPNPMODEL_URL:
strncpy(model_url, ary_options[i].value, MODEL_URL_MAX_LEN);
model_url[MODEL_URL_MAX_LEN-1] = '\0';
break;
#ifdef USE_NETFILTER
case UPNPFORWARDCHAIN:
miniupnpd_forward_chain = ary_options[i].value;

View File

@ -44,9 +44,24 @@ max_lifetime=86400
# lease file location
#lease_file=/var/log/upnp.leases
# name of this service, default is "`uname -s` Router"
# name of this service, default is "`uname -s` router"
#friendly_name=MiniUPnPd router
# manufacturer name, default is "`uname -s`"
#manufacturer_name=ACME Inc.
# manufacturer url, default is URL of OS verndor
#manufacturer_url=http://www.acme.com
# model name, default is "`uname -s` router"
#model_name=VSR-3030
# model description, default is "`uname -s` router"
#model_description=Very Secure Router - Model 3030
# model url, default is URL of OS verndor
#model_url=http://www.acme.com/products/vsr3030
# bitrates reported by daemon in bits per second
bitrate_up=1000000
bitrate_down=10000000

View File

@ -36,6 +36,11 @@ static const struct {
{ UPNPBITRATE_DOWN, "bitrate_down" },
{ UPNPPRESENTATIONURL, "presentation_url" },
{ UPNPFRIENDLY_NAME, "friendly_name" },
{ UPNPMANUFACTURER_NAME, "manufacturer_name" },
{ UPNPMANUFACTURER_URL, "manufacturer_url" },
{ UPNPMODEL_NAME, "model_name" },
{ UPNPMODEL_DESCRIPTION, "model_description" },
{ UPNPMODEL_URL, "model_url" },
{ UPNPNOTIFY_INTERVAL, "notify_interval" },
{ UPNPSYSTEM_UPTIME, "system_uptime" },
{ UPNPPACKET_LOG, "packet_log" },

View File

@ -23,6 +23,11 @@ enum upnpconfigoptions {
UPNPBITRATE_DOWN, /* "bitrate_down" */
UPNPPRESENTATIONURL, /* presentation_url */
UPNPFRIENDLY_NAME, /* "friendly_name" */
UPNPMANUFACTURER_NAME, /* "manufacturer_name" */
UPNPMANUFACTURER_URL, /* "manufacturer_url" */
UPNPMODEL_NAME, /* "model_name" */
UPNPMODEL_DESCRIPTION, /* "model_description" */
UPNPMODEL_URL, /* "model_url" */
UPNPNOTIFY_INTERVAL, /* notify_interval */
UPNPSYSTEM_UPTIME, /* "system_uptime" */
UPNPPACKET_LOG, /* "packet_log" */

View File

@ -16,6 +16,7 @@
#include "macros.h"
#include "config.h"
#include "upnpdescgen.h"
#include "upnpdescstrings.h"
char uuidvalue_igd[] = "uuid:12345678-0000-0000-0000-000000abcd01";
char uuidvalue_wan[] = "uuid:12345678-0000-0000-0000-000000abcd02";
@ -25,6 +26,11 @@ char modelnumber[] = "1";
char presentationurl[] = "http://192.168.0.1:8080/";
/*char presentationurl[] = "";*/
char friendly_name[] = OS_NAME " router";
char manufacturer_name[] = ROOTDEV_MANUFACTURER;
char manufacturer_url[] = ROOTDEV_MANUFACTURERURL;
char model_name[] = ROOTDEV_MODELNAME;
char model_description[] = ROOTDEV_MODELDESCRIPTION;
char model_url[] = ROOTDEV_MODELURL;
char * use_ext_ip_addr = NULL;
const char * ext_if_name = "eth0";

View File

@ -146,13 +146,13 @@ static const struct XMLElt rootDesc[] =
{"/deviceType", DEVICE_TYPE_IGD},
/* urn:schemas-upnp-org:device:InternetGatewayDevice:1 or 2 */
{"/friendlyName", friendly_name/*ROOTDEV_FRIENDLYNAME*/}, /* required */
{"/manufacturer", ROOTDEV_MANUFACTURER}, /* required */
{"/manufacturer", manufacturer_name/*ROOTDEV_MANUFACTURER*/}, /* required */
/* 8 */
{"/manufacturerURL", ROOTDEV_MANUFACTURERURL}, /* optional */
{"/modelDescription", ROOTDEV_MODELDESCRIPTION}, /* recommended */
{"/modelName", ROOTDEV_MODELNAME}, /* required */
{"/manufacturerURL", manufacturer_url/*ROOTDEV_MANUFACTURERURL*/}, /* optional */
{"/modelDescription", model_description/*ROOTDEV_MODELDESCRIPTION*/}, /* recommended */
{"/modelName", model_name/*ROOTDEV_MODELNAME*/}, /* required */
{"/modelNumber", modelnumber},
{"/modelURL", ROOTDEV_MODELURL},
{"/modelURL", model_url/*ROOTDEV_MODELURL*/},
{"/serialNumber", serialnumber},
{"/UDN", uuidvalue_igd}, /* required */
/* see if /UPC is needed. */

View File

@ -10,6 +10,7 @@
#include "config.h"
#include "upnpglobalvars.h"
#include "upnpdescstrings.h"
/* network interface for internet */
const char * ext_if_name = 0;
@ -53,6 +54,21 @@ char presentationurl[PRESENTATIONURL_MAX_LEN];
/* friendly name for root devices in XML description */
char friendly_name[FRIENDLY_NAME_MAX_LEN] = OS_NAME " router";
/* manufacturer name for root devices in XML description */
char manufacturer_name[MANUFACTURER_NAME_MAX_LEN] = ROOTDEV_MANUFACTURER;
/* manufacturer url for root devices in XML description */
char manufacturer_url[MANUFACTURER_URL_MAX_LEN] = ROOTDEV_MANUFACTURERURL;
/* model name for root devices in XML description */
char model_name[MODEL_NAME_MAX_LEN] = ROOTDEV_MODELNAME;
/* model description for root devices in XML description */
char model_description[MODEL_DESCRIPTION_MAX_LEN] = ROOTDEV_MODELDESCRIPTION;
/* model url for root devices in XML description */
char model_url[MODEL_URL_MAX_LEN] = ROOTDEV_MODELURL;
/* UPnP permission rules : */
struct upnpperm * upnppermlist = 0;
unsigned int num_upnpperm = 0;

View File

@ -74,6 +74,21 @@ extern char presentationurl[];
#define FRIENDLY_NAME_MAX_LEN (64)
extern char friendly_name[];
#define MANUFACTURER_NAME_MAX_LEN (64)
extern char manufacturer_name[];
#define MANUFACTURER_URL_MAX_LEN (64)
extern char manufacturer_url[];
#define MODEL_NAME_MAX_LEN (64)
extern char model_name[];
#define MODEL_DESCRIPTION_MAX_LEN (64)
extern char model_description[];
#define MODEL_URL_MAX_LEN (64)
extern char model_url[];
/* UPnP permission rules : */
extern struct upnpperm * upnppermlist;
extern unsigned int num_upnpperm;