summaryrefslogtreecommitdiff
path: root/net/mlvpn/files/patch-src_config.c
blob: 5b9b5d498dd0763884e8bfcc304a64f067d7c9af (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
--- src/config.c.orig	2015-12-28 11:20:16 UTC
+++ src/config.c
@@ -269,6 +269,7 @@ mlvpn_config(int config_file_fd, int fir
             } else if (strncmp(lastSection, "filters", 7) != 0) {
                 char *bindaddr;
                 char *bindport;
+				uint32_t bindfib = 0;
                 char *dstaddr;
                 char *dstport;
                 uint32_t bwlimit = 0;
@@ -284,6 +285,9 @@ mlvpn_config(int config_file_fd, int fir
                     _conf_set_str_from_conf(
                         config, lastSection, "bindport", &bindport, NULL,
                         "bind port is mandatory in server mode.\n", 1);
+					_conf_set_uint_from_conf(
+						config, lastSection, "bindfib", &bindfib, 0,
+						NULL, 0);
                     _conf_set_str_from_conf(
                         config, lastSection, "remotehost", &dstaddr, NULL,
                         NULL, 0);
@@ -297,6 +301,9 @@ mlvpn_config(int config_file_fd, int fir
                     _conf_set_str_from_conf(
                         config, lastSection, "bindport", &bindport, NULL,
                         NULL, 0);
+					 _conf_set_uint_from_conf(
+						config, lastSection, "bindfib", &bindfib, 0,
+						NULL, 0);
                     _conf_set_str_from_conf(
                         config, lastSection, "remotehost", &dstaddr, NULL,
                         "No remote address specified.\n", 1);
@@ -336,6 +343,7 @@ mlvpn_config(int config_file_fd, int fir
                               tmptun->name);
                         if ((! mystr_eq(tmptun->bindaddr, bindaddr)) ||
                                 (! mystr_eq(tmptun->bindport, bindport)) ||
+								(tmptun->bindfib != bindfib) ||
                                 (! mystr_eq(tmptun->destaddr, dstaddr)) ||
                                 (! mystr_eq(tmptun->destport, dstport))) {
                             mlvpn_rtun_status_down(tmptun);
@@ -347,6 +355,9 @@ mlvpn_config(int config_file_fd, int fir
                         if (bindport) {
                             strlcpy(tmptun->bindport, bindport, sizeof(tmptun->bindport));
                         }
+						if (tmptun->bindfib != bindfib) {
+							tmptun->bindfib = bindfib;
+						}
                         if (dstaddr) {
                             strlcpy(tmptun->destaddr, dstaddr, sizeof(tmptun->destaddr));
                         }
@@ -380,7 +391,7 @@ mlvpn_config(int config_file_fd, int fir
                 {
                     log_info("config", "%s tunnel added", lastSection);
                     mlvpn_rtun_new(
-                        lastSection, bindaddr, bindport, dstaddr, dstport,
+                        lastSection, bindaddr, bindport, bindfib, dstaddr, dstport,
                         default_server_mode, timeout, fallback_only,
                         bwlimit, loss_tolerence);
                 }