diff options
| author | Qiuwen Lu <[email protected]> | 2019-07-23 16:27:40 +0600 |
|---|---|---|
| committer | Qiuwen Lu <[email protected]> | 2019-07-23 16:27:40 +0600 |
| commit | 6ee158963cf332e6d7e64b5d1d5da203f7680beb (patch) | |
| tree | b3551f7036c1f2d9a1a676f68d4be65c33ecf6c4 | |
| parent | 7325142bcd79fcfe30e262d4f55dab485bc2995e (diff) | |
修正VlanFilpping隧道没有输出JSON日志的问题。v4.3.12-20190723feature-tunnat-table-using-4-tuple
| -rw-r--r-- | tunnat/include/tunnel.h | 2 | ||||
| -rw-r--r-- | tunnat/src/tunnel.cc | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/tunnat/include/tunnel.h b/tunnat/include/tunnel.h index 80a9610..c56c006 100644 --- a/tunnat/include/tunnel.h +++ b/tunnat/include/tunnel.h @@ -191,7 +191,7 @@ public: void MbufMetaConstruct(marsio_buff_t * mbuf) override; size_t ToHashKey(char * out_hashkey, size_t sz_hash_key) const override { return 0; } - cJSON * ToJSON() const override { return nullptr; } + cJSON * ToJSON() const override; bool operator==(const TunVlanFlipping & rhs); diff --git a/tunnat/src/tunnel.cc b/tunnat/src/tunnel.cc index ab3f366..f3b496b 100644 --- a/tunnat/src/tunnel.cc +++ b/tunnat/src/tunnel.cc @@ -460,6 +460,18 @@ bool TunVlanFlipping::operator==(const TunVlanFlipping & rhs) return vlan_id_ == rhs.vlan_id_ && vlan_id_map_ == rhs.vlan_id_map_; } +cJSON * TunVlanFlipping::ToJSON() const +{ + cJSON * j_object = cJSON_CreateObject(); + cJSON_AddNumberToObject(j_object, "vlan_id", vlan_id_); + cJSON_AddNumberToObject(j_object, "vlan_id_map", vlan_id_map_); + + unsigned int offload_by_nics_in_number = vlan_id_offload_by_nic_ ? 1 : 0; + cJSON_AddNumberToObject(j_object, "offload_by_nics", offload_by_nics_in_number); + + return j_object; +} + extern "C" { #include <ldbc.h> |
