diff options
| author | Qiuwen Lu <[email protected]> | 2019-10-11 00:13:42 +0800 |
|---|---|---|
| committer | Qiuwen Lu <[email protected]> | 2019-10-11 00:13:42 +0800 |
| commit | 7b8ad9ec419ff36038f5af4cf7b9f7e047c0d7cb (patch) | |
| tree | f5b176b477a8d29352fa719cdc815e38459b0e4e | |
| parent | c90fdc817337a6086e4889bfe61a49982f018245 (diff) | |
修正在VLAN Flipping接入方式时填充控制域没有判断隧道边界导致的段错误。v4.3.15-20191011
| -rw-r--r-- | tunnat/include/tunnel.h | 5 | ||||
| -rw-r--r-- | tunnat/src/runtime.cc | 6 |
2 files changed, 8 insertions, 3 deletions
diff --git a/tunnat/include/tunnel.h b/tunnat/include/tunnel.h index 937c173..086dc78 100644 --- a/tunnat/include/tunnel.h +++ b/tunnat/include/tunnel.h @@ -437,11 +437,12 @@ struct TunnelContainerArray TunnelContainer * GetTunContainerWithType(enum tunnel_type type) { - for (auto & tun_container : tun_array) + for (unsigned int i = 0; i < sz_array; i++) { + auto & tun_container = tun_array[i]; if (tun_container.ThisTunType() == type) return &tun_container; } - + return nullptr; } diff --git a/tunnat/src/runtime.cc b/tunnat/src/runtime.cc index b9d156f..0ee38fa 100644 --- a/tunnat/src/runtime.cc +++ b/tunnat/src/runtime.cc @@ -260,7 +260,11 @@ static int __phy_to_virt_pkt_modify(TunnatInstance * instance, TunnatThreadInsta TunnelContainer & outer_tunnel = tun_array.GetOuterTunContainer(); TunnelContainer & inner_tunnel = tun_array.GetInnerTunContainer(); - __phy_to_virt_pkt_fill_addressinfo(instance, ctrlzone, tun_array); + /* 只有当隧道信息解析成功时,才向控制域填充MAC地址等信息 */ + if (tun_array.sz_array > 0) + { + __phy_to_virt_pkt_fill_addressinfo(instance, ctrlzone, tun_array); + } /* 对于内层隧道不是IPv4或IPv6的,不剥离外层隧道,直接送入应用 */ if (inner_tunnel.ThisTunType() != TUNNEL_TYPE_IPV4 && inner_tunnel.ThisTunType() != TUNNEL_TYPE_IPV6) |
