projects
/
oweals
/
tinc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Allow a port to be specified in BindToAddress statements.
[oweals/tinc.git]
/
src
/
net_setup.c
diff --git
a/src/net_setup.c
b/src/net_setup.c
index 2684514392dac017d4b3faeba8f8b4aa510bce69..29d4952a42e114827658bc5115e36cbea079ecf9 100644
(file)
--- a/
src/net_setup.c
+++ b/
src/net_setup.c
@@
-587,12
+587,25
@@
static bool setup_myself(void) {
if(cfg)
cfg = lookup_config_next(config_tree, cfg);
if(cfg)
cfg = lookup_config_next(config_tree, cfg);
+ char *port = myport;
+
+ if(address) {
+ char *space = strchr(address, ' ');
+ if(space) {
+ *space++ = 0;
+ port = space;
+ }
+
+ if(!strcmp(address, "*"))
+ *address = 0;
+ }
+
hint.ai_family = addressfamily;
hint.ai_socktype = SOCK_STREAM;
hint.ai_protocol = IPPROTO_TCP;
hint.ai_flags = AI_PASSIVE;
hint.ai_family = addressfamily;
hint.ai_socktype = SOCK_STREAM;
hint.ai_protocol = IPPROTO_TCP;
hint.ai_flags = AI_PASSIVE;
- err = getaddrinfo(address
, my
port, &hint, &ai);
+ err = getaddrinfo(address
&& *address ? address : NULL,
port, &hint, &ai);
free(address);
if(err || !ai) {
free(address);
if(err || !ai) {