]> git.meshlink.io Git - meshlink/commitdiff
Tell invited node about Mode and Broadcast settings.
authorGuus Sliepen <guus@tinc-vpn.org>
Fri, 23 Aug 2013 22:48:24 +0000 (00:48 +0200)
committerGuus Sliepen <guus@tinc-vpn.org>
Fri, 23 Aug 2013 22:48:24 +0000 (00:48 +0200)
Since these settings really should be the same for all nodes in a VPN.

src/invitation.c

index 188ea2dbdb75dd1ddf628d507be8a7de428f9141..36dfa41b64b1d2a62a04f66d66006e72c4a987ba 100644 (file)
@@ -381,7 +381,19 @@ int cmd_invite(int argc, char *argv[]) {
        if(netname)
                fprintf(f, "NetName = %s\n", netname);
        fprintf(f, "ConnectTo = %s\n", myname);
-       // TODO: copy Broadcast and Mode
+
+       // Copy Broadcast and Mode
+       FILE *tc = fopen(tinc_conf, "r");
+       if(tc) {
+               char buf[1024];
+               while(fgets(buf, sizeof buf, tc)) {
+                       if((!strncasecmp(buf, "Mode", 4) && strchr(" \t=", buf[4]))
+                                       || (!strncasecmp(buf, "Broadcast", 9) && strchr(" \t=", buf[9])))
+                               fputs(buf, f);
+               }
+               fclose(tc);
+       }
+
        fprintf(f, "#---------------------------------------------------------------#\n");
        fprintf(f, "Name = %s\n", myname);