diff --git a/socle b/socle index 4562035..9301446 160000 --- a/socle +++ b/socle @@ -1 +1 @@ -Subproject commit 4562035f9d4559df0c9dad557431c3c9b9de841e +Subproject commit 9301446a0e37d08932a24903166596939d6b7661 diff --git a/src/service/cfgapi/cfgapi.cpp b/src/service/cfgapi/cfgapi.cpp index f2753b4..617462c 100644 --- a/src/service/cfgapi/cfgapi.cpp +++ b/src/service/cfgapi/cfgapi.cpp @@ -469,6 +469,10 @@ bool CfgFactory::upgrade_schema(int upgrade_to_num) { log.event(INF, "added settings.webhook.bind_interface"); return true; } + else if(upgrade_to_num == 1028) { + log.event(INF, "added captures.remote.bind_interface"); + return true; + } return false; } @@ -949,6 +953,7 @@ bool CfgFactory::load_captures() { load_if_exists(remote, "tun_type", CfgFactory::get()->capture_remote.tun_type); load_if_exists(remote, "tun_dst", CfgFactory::get()->capture_remote.tun_dst); load_if_exists(remote, "tun_ttl", CfgFactory::get()->capture_remote.tun_ttl); + load_if_exists(remote, "bind_interface", CfgFactory::get()->capture_remote.bind_interface); CfgFactory::gre_export_apply(&traflog::PcapLog::single_instance()); } @@ -2929,8 +2934,13 @@ void CfgFactory::gre_export_apply(traflog::PcapLog* pcaplog) { auto exp = std::make_shared(fam, ip); pcaplog->ip_packet_hook = exp; - if(cfg->capture_remote.tun_ttl > 0) + + if(cfg->capture_remote.tun_ttl > 0) { exp->ttl(cfg->capture_remote.tun_ttl); + } + if(not cfg->capture_remote.bind_interface.empty()) { + exp->bind_if(cfg->capture_remote.bind_interface); + } } else { pcaplog->ip_packet_hook.reset(); @@ -5098,6 +5108,7 @@ int CfgFactory::save_captures(Config& ex) const { remote.add("tun_type", Setting::TypeString) = CfgFactory::get()->capture_remote.tun_type; remote.add("tun_dst", Setting::TypeString) = CfgFactory::get()->capture_remote.tun_dst; remote.add("tun_ttl", Setting::TypeInt) = CfgFactory::get()->capture_remote.tun_ttl; + remote.add("bind_interface", Setting::TypeString) = CfgFactory::get()->capture_remote.bind_interface; if(not objects.exists("options")) diff --git a/src/service/cfgapi/cfgapi.hpp b/src/service/cfgapi/cfgapi.hpp index 9721145..a41b3be 100644 --- a/src/service/cfgapi/cfgapi.hpp +++ b/src/service/cfgapi/cfgapi.hpp @@ -202,7 +202,7 @@ class CfgFactory : public CfgFactoryBase { public: // Each version bump implies a config upgrade - we start on 1000 // see upgrade_schema() - control config upgrade - constexpr static inline const int SCHEMA_VERSION = 1027; + constexpr static inline const int SCHEMA_VERSION = 1028; static inline std::atomic_bool LOAD_ERRORS = false; @@ -341,6 +341,7 @@ class CfgFactory : public CfgFactoryBase { std::string tun_type = "gre"; std::string tun_dst = "127.0.0.1"; int tun_ttl {1}; + std::string bind_interface; } capture_remote; struct {