diff options
| author | Qiuwen Lu <[email protected]> | 2017-09-18 14:28:18 +0800 |
|---|---|---|
| committer | Qiuwen Lu <[email protected]> | 2017-09-18 14:28:18 +0800 |
| commit | 2b9b23b50e15ef9ab8c4ab84987c0044e600b82f (patch) | |
| tree | 571e4a18977d9cccf22443da5a407853a0511fba /tunnat/include | |
| parent | 89818554f1460f95469feeeffa3103fa935ef71c (diff) | |
增加HDLC、PPP支持;修正Neigh表在SMP架构上初始化的问题;v4.2.17-20170918
- 增加Tunnat对HDLC、PPP内层封装报文的解析和构建功能;
- 修正Neigh表在SMP架构上初始化失败的问题。原实现没有指定Hash表使用的内存的NUMA节点,在memset时填充为0。在非NUMA架构上,NUMA0节点上可能没有内存,导致初始化失败。
- 修正部分笔误。
Diffstat (limited to 'tunnat/include')
| -rw-r--r-- | tunnat/include/tunnel.h | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/tunnat/include/tunnel.h b/tunnat/include/tunnel.h index 1ccbdf4..654120e 100644 --- a/tunnat/include/tunnel.h +++ b/tunnat/include/tunnel.h @@ -154,7 +154,10 @@ public: std::swap<ether_addr>(ether_hdr_.s_addr, ether_hdr_.d_addr); } - static int PacketForwardModify(const char * pkt, unsigned int pkt_len); + static int PacketForwardModify(const char * pkt, unsigned int pkt_len) + { + return 0; + } }; class TunInnerIPv4 : public Tunnel @@ -192,16 +195,48 @@ class TunInnerPPP : public Tunnel { public: int PacketParse(const char * pkt, unsigned int pkt_len); + int PacketConstruct(const char * pkt, unsigned int pkt_len) + { + *(uint32_t *)pkt = ppp_header_;
+ return 0; + } + + static int PacketForwardModify(const char * pkt, unsigned int pkt_len) + { + return 0; + } + void ReverseAddress() { return; } + +protected: + uint32_t ppp_header_; }; class TunInnerHDLC : public Tunnel { public: int PacketParse(const char * pkt, unsigned int pkt_len); + int PacketConstruct(const char * pkt, unsigned int pkt_len) + { + *(uint32_t *)pkt = hdlc_header_;
+ return 0; + } + + static int PacketForwardModify(const char * pkt, unsigned int pkt_len) + { + return 0; + } + + void ReverseAddress() + { + return; + } + +protected: + uint32_t hdlc_header_; }; class TunnelContainer |
