* Copyright (C) 2022 Felix Fietkau <nbd@nbd.name>
*/
#include <arpa/inet.h>
+#include <sys/types.h>
+#include <sys/socket.h>
#include <sys/wait.h>
+#include <net/if.h>
#include <libubox/avl-cmp.h>
#include <libubox/utils.h>
#include <libubox/blobmsg_json.h>
[NETWORK_ATTR_KEEPALIVE] = { "keepalive", BLOBMSG_TYPE_INT32 },
[NETWORK_ATTR_DOMAIN] = { "domain", BLOBMSG_TYPE_STRING },
[NETWORK_ATTR_UPDATE_CMD] = { "update-cmd", BLOBMSG_TYPE_STRING },
+ [NETWORK_ATTR_TUNNELS] = { "tunnels", BLOBMSG_TYPE_TABLE },
};
AVL_TREE(networks, avl_strcmp, false, NULL);
return -1;
}
+ net->ifindex = if_nametoindex(network_name(net));
+ if (!net->ifindex) {
+ fprintf(stderr, "Could not get ifindex for network %s\n", network_name(net));
+ return -1;
+ }
+
return 0;
}
if ((cur = tb[NETWORK_ATTR_DOMAIN]) != NULL)
net->config.domain = blobmsg_get_string(cur);
+ if ((cur = tb[NETWORK_ATTR_TUNNELS]) != NULL)
+ net->config.tunnels = cur;
+
if ((cur = tb[NETWORK_ATTR_KEY]) == NULL)
goto invalid;