summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQiuwen Lu <[email protected]>2017-10-25 16:24:10 +0800
committerQiuwen Lu <[email protected]>2017-10-25 16:24:10 +0800
commit0292bd0cf7649dce1ff67456aa9d9af0d9afbe97 (patch)
treedaeaf37eb6e934e80bb62adf77cf0a0ee9a0f76a
parent25737a54491685a4321fe0179430cc629e6602d5 (diff)
修正TunnerContainer拷贝构造函数没有拷贝PPP对象的Bug。v4.2.29-20171027
- TunnelContainer的拷贝构造函数有缺陷,没有复制PPP对象成员变量,向Session表中存储PPP格式隧道信息时,复制的对象信息错误,导致基于此构建的PPP报文格式错误。现修正。
-rw-r--r--tunnat/include/tunnel.h20
-rw-r--r--tunnat/src/session.cc4
2 files changed, 15 insertions, 9 deletions
diff --git a/tunnat/include/tunnel.h b/tunnat/include/tunnel.h
index 654120e..c0b31fa 100644
--- a/tunnat/include/tunnel.h
+++ b/tunnat/include/tunnel.h
@@ -115,7 +115,7 @@ public:
int PacketParse(const char * pkt, unsigned int pkt_len);
int CtrlZoneParse(struct mr_tunnat_ctrlzone * ctrlzone);
int PacketConstruct(const char * pkt, unsigned int pkt_len);
-
+
int GetAddressInfo(struct AddressInfo & addr_info)
{
addr_info.src_in_addr = src_in_addr_;
@@ -197,7 +197,7 @@ public:
int PacketParse(const char * pkt, unsigned int pkt_len);
int PacketConstruct(const char * pkt, unsigned int pkt_len)
{
- *(uint32_t *)pkt = ppp_header_;
+ *(uint32_t *)pkt = ppp_header_;
return 0;
}
@@ -221,7 +221,7 @@ public:
int PacketParse(const char * pkt, unsigned int pkt_len);
int PacketConstruct(const char * pkt, unsigned int pkt_len)
{
- *(uint32_t *)pkt = hdlc_header_;
+ *(uint32_t *)pkt = hdlc_header_;
return 0;
}
@@ -244,7 +244,7 @@ class TunnelContainer
public:
int ThisTunLength();
enum tunnel_type ThisTunType();
- enum tunnel_type NextTunType();
+ enum tunnel_type NextTunType();
int PacketParse(const char * pkt, unsigned int pkt_len,
enum tunnel_type tunnel_type = TUNNEL_TYPE_UNKNOWN);
@@ -266,19 +266,20 @@ protected:
TunInnerPPP tun_inner_ppp_;
TunInnerIPv4 tun_inner_ipv4_;
TunInnerIPv6 tun_inner_ipv6_;
-
+
enum tunnel_type this_layer_type;
Tunnel * tun_object_;
public:
TunnelContainer() : tun_object_(nullptr) {}
- TunnelContainer(const TunnelContainer & orin) :
+ TunnelContainer(const TunnelContainer & orin) :
tun_vxlan_object_(orin.tun_vxlan_object_),
- tun_qmac_object_(orin.tun_qmac_object_),
+ tun_qmac_object_(orin.tun_qmac_object_),
tun_inner_ether_(orin.tun_inner_ether_),
- tun_inner_hdlc_(orin.tun_inner_hdlc_),
+ tun_inner_hdlc_(orin.tun_inner_hdlc_),
+ tun_inner_ppp_(orin.tun_inner_ppp_),
tun_inner_ipv4_(orin.tun_inner_ipv4_),
- tun_inner_ipv6_(orin.tun_inner_ipv6_),
+ tun_inner_ipv6_(orin.tun_inner_ipv6_),
this_layer_type(orin.this_layer_type),
tun_object_(tun_object_get())
{}
@@ -289,6 +290,7 @@ public:
this->tun_qmac_object_ = orin.tun_qmac_object_;
this->tun_inner_ether_ = orin.tun_inner_ether_;
this->tun_inner_hdlc_ = orin.tun_inner_hdlc_;
+ this->tun_inner_ppp_ = orin.tun_inner_ppp_;
this->tun_inner_ipv4_ = orin.tun_inner_ipv4_;
this->tun_inner_ipv6_ = orin.tun_inner_ipv6_;
this->this_layer_type = orin.this_layer_type;
diff --git a/tunnat/src/session.cc b/tunnat/src/session.cc
index 1e2569e..51c1810 100644
--- a/tunnat/src/session.cc
+++ b/tunnat/src/session.cc
@@ -25,6 +25,10 @@ reverse_dir:
__temp_session_entry.tun_array.ReverseAddress();
Add(key, __temp_session_entry);
}
+ else
+ {
+ return NULL;
+ }
/* 再次查询 */
ss_entry = Query(key);