- if (!(file = fopen(CONFIG_ROOT "/vpn/config", "r"))) {
- fprintf(stderr, "Couldn't open vpn settings file");
- exit(1);
- }
- while (fgets(s, STRING_SIZE, file) != NULL) {
- char *key;
- char *name;
- char *type;
- char *interface;
- if (!decode_line(s,&key,&name,&type,&interface))
- continue;
- /* search interface */
- if (!enable_red && strcmp (interface, "RED") == 0) {
- // when RED is up, find interface name in special file
- FILE *ifacefile = NULL;
- if ((ifacefile = fopen(CONFIG_ROOT "/red/iface", "r"))) {
- if (fgets(if_red, STRING_SIZE, ifacefile)) {
- if (if_red[strlen(if_red) - 1] == '\n')
- if_red[strlen(if_red) - 1] = '\0';
- }
- fclose (ifacefile);
-
- if (VALID_DEVICE(if_red))
- enable_red+=2; // present and running
- }
+ // when RED is up, find interface name in special file
+ FILE *ifacefile = NULL;
+ if ((ifacefile = fopen(CONFIG_ROOT "/red/iface", "r"))) {
+ if (fgets(if_red, STRING_SIZE, ifacefile)) {
+ if (if_red[strlen(if_red) - 1] == '\n')
+ if_red[strlen(if_red) - 1] = '\0';