Convert Port to numeric form before sending it to other nodes.

If one uses a symbolic name for the Port option, tinc will send that name
literally to other nodes.  However, it is not guaranteed that all nodes have
the same contents in /etc/services, or have such a file at all.
This commit is contained in:
Guus Sliepen 2010-04-03 09:46:45 +01:00
parent 292354912f
commit f75e71bc69
3 changed files with 16 additions and 5 deletions

View file

@ -497,7 +497,7 @@ static void send_everything(connection_t *c) {
bool ack_h(connection_t *c) {
char hisport[MAX_STRING_SIZE];
char *hisaddress, *dummy;
char *hisaddress;
int weight, mtu;
uint32_t options;
node_t *n;
@ -566,10 +566,9 @@ bool ack_h(connection_t *c) {
c->edge = new_edge();
c->edge->from = myself;
c->edge->to = n;
sockaddr2str(&c->address, &hisaddress, &dummy);
sockaddr2str(&c->address, &hisaddress, NULL);
c->edge->address = str2sockaddr(hisaddress, hisport);
free(hisaddress);
free(dummy);
c->edge->weight = (weight + c->estimated_weight) / 2;
c->edge->connection = c;
c->edge->options = c->options;