mirror of
https://github.com/owntone/owntone-server.git
synced 2025-02-03 01:46:02 -05:00
Add interface directive to config file -- fix stderr logging on rendezvous child
This commit is contained in:
parent
fa48f1175b
commit
ab17d88879
@ -133,6 +133,7 @@ CONFIGELEMENT config_elements[] = {
|
||||
{ 1,0,0,CONFIG_TYPE_INT,"compress",(void*)&config.compress,config_emit_int },
|
||||
{ 1,0,0,CONFIG_TYPE_STRING,"playlist",(void*)&config.playlist,config_emit_string },
|
||||
{ 1,0,0,CONFIG_TYPE_STRING,"extensions",(void*)&config.extensions,config_emit_string },
|
||||
{ 1,0,0,CONFIG_TYPE_STRING,"interface",(void*)&config.iface,config_emit_string },
|
||||
{ 1,0,0,CONFIG_TYPE_STRING,"ssc_extensions",(void*)&config.ssc_extensions,config_emit_string },
|
||||
{ 1,0,0,CONFIG_TYPE_STRING,"ssc_prog",(void*)&config.ssc_prog,config_emit_string },
|
||||
{ 1,0,0,CONFIG_TYPE_STRING,"password",(void*)&config.readpassword, config_emit_string },
|
||||
@ -303,6 +304,7 @@ int config_read(char *file) {
|
||||
config.web_root=NULL;
|
||||
config.adminpassword=NULL;
|
||||
config.readpassword=NULL;
|
||||
config.iface=NULL;
|
||||
config.mp3dir=NULL;
|
||||
config.playlist=NULL;
|
||||
config.runas=NULL;
|
||||
|
@ -49,6 +49,7 @@ typedef struct tag_config {
|
||||
int reload; /**< Time to reload and/or rescan the database? */
|
||||
char *configfile; /**< path to config file */
|
||||
char *web_root; /**< path to the dir containing the web files */
|
||||
char *iface; /**< interface to advertise on */
|
||||
int port; /**< port to listen on */
|
||||
int rescan_interval; /**< How often to do a background fs rescan */
|
||||
int always_scan; /**< 0 to minimize disk usage (embedded devices) */
|
||||
|
@ -118,7 +118,7 @@ void err_log(int level, unsigned int cat, char *fmt, ...)
|
||||
|
||||
err_lock_mutex(); /* atomic file writes */
|
||||
|
||||
if((!level) && (err_logdestination != LOGDEST_STDERR) && (!(cat & L_REND))) {
|
||||
if((!level) && (err_logdestination != LOGDEST_STDERR)) {
|
||||
fprintf(stderr,"%s",errbuf);
|
||||
fprintf(stderr,"Aborting\n");
|
||||
fflush(stderr); /* shouldn't have to do this? */
|
||||
|
@ -517,8 +517,8 @@ int main(int argc, char *argv[]) {
|
||||
#ifndef WITHOUT_MDNS
|
||||
if(config.use_mdns) { /* register services */
|
||||
DPRINTF(E_LOG,L_MAIN|L_REND,"Registering rendezvous names\n");
|
||||
rend_register(config.servername,"_daap._tcp",config.port);
|
||||
rend_register(config.servername,"_http._tcp",config.port);
|
||||
rend_register(config.servername,"_daap._tcp",config.port,config.iface);
|
||||
rend_register(config.servername,"_http._tcp",config.port,config.iface);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -89,6 +89,9 @@
|
||||
Change History (most recent first):
|
||||
|
||||
$Log$
|
||||
Revision 1.25 2005/08/16 02:26:32 rpedde
|
||||
Add interface directive to config file -- fix stderr logging on rendezvous child
|
||||
|
||||
Revision 1.24 2005/08/15 03:16:54 rpedde
|
||||
specify interface to register
|
||||
|
||||
@ -196,6 +199,21 @@
|
||||
#include "rend-unix.h"
|
||||
|
||||
|
||||
/*
|
||||
* I'll take some extra hackishness, please...
|
||||
*/
|
||||
typedef struct PosixNetworkInterface PosixNetworkInterface;
|
||||
|
||||
struct PosixNetworkInterface {
|
||||
NetworkInterfaceInfo coreIntf;
|
||||
const char * intfName;
|
||||
PosixNetworkInterface * aliasIntf;
|
||||
int index;
|
||||
int multicastSocket;
|
||||
int multicastSocketv6;
|
||||
};
|
||||
|
||||
|
||||
static mDNS mDNSStorage; // mDNS core uses this to store its globals
|
||||
static mDNS_PlatformSupport PlatformStorage; // Stores this platform's globals
|
||||
|
||||
@ -394,21 +412,30 @@ static void DeregisterOurServices(void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
mDNSInterfaceID rend__get_interface_id(char *iface) {
|
||||
mDNSInterfaceID rend_get_interface_id(char *iface) {
|
||||
PosixNetworkInterface *pni;
|
||||
|
||||
if(!iface)
|
||||
return mDNSInterface_Any;
|
||||
|
||||
/* we'll cheat and get the underlying posix interface */
|
||||
pni = SearchForInterfaceByName(mDNSStorage, iface);
|
||||
if(!pni) {
|
||||
DPRINTF(E_LOG,L_REND,"Could not find interface %s - ignoring\n");
|
||||
if(!strlen(iface))
|
||||
return mDNSInterface_Any;
|
||||
|
||||
DPRINTF(E_LOG,L_REND,"Searching for interface %s\n",iface);
|
||||
|
||||
pni=(PosixNetworkInterface*)mDNSStorage.HostInterfaces;
|
||||
while(pni) {
|
||||
DPRINTF(E_INF,L_REND,"Found interface %s, index %d\n",pni->intfName,
|
||||
pni->index);
|
||||
if(strcasecmp(pni->intfName,iface) == 0) {
|
||||
DPRINTF(E_INF,L_REND,"Found interface id: %d\n",pni->coreIntf.InterfaceID);
|
||||
return pni->coreIntf.InterfaceID;
|
||||
}
|
||||
pni=(PosixNetworkInterface*)(pni->coreIntf.next);
|
||||
}
|
||||
|
||||
return pni->coreIntf.mDNSInterfaceID;
|
||||
DPRINTF(E_INF,L_REND,"Could not find interface.\n");
|
||||
return mDNSInterface_Any;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -463,6 +490,9 @@ int rend_private_init(char *user) {
|
||||
mStatus status;
|
||||
mDNSBool result;
|
||||
|
||||
|
||||
fprintf(stderr,"w00t\n");
|
||||
|
||||
status = mDNS_Init(&mDNSStorage, &PlatformStorage,
|
||||
mDNS_Init_NoCache, mDNS_Init_ZeroCacheSize,
|
||||
mDNS_Init_AdvertiseLocalAddresses,
|
||||
|
@ -108,7 +108,7 @@ int rend_init(char *user) {
|
||||
if((fd = open("/dev/null", O_RDWR, 0)) != -1) {
|
||||
dup2(fd, STDIN_FILENO);
|
||||
dup2(fd, STDOUT_FILENO);
|
||||
dup2(fd, STDERR_FILENO);
|
||||
// dup2(fd, STDERR_FILENO);
|
||||
if (fd > 2)
|
||||
close(fd);
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
#ifndef _REND_UNIX_H_
|
||||
#define _REND_UNIX_H_
|
||||
|
||||
#define MAX_NAME_LEN 256
|
||||
#define MAX_NAME_LEN 200
|
||||
/* Is there a posixly correct constant for this? */
|
||||
#define MAX_IFACE_NAME_LEN 20
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user