4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivelibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change
on this file since 10553bf was
ebb54a5,
checked in by Shane Alcock <salcock@…>, 7 years ago
|
Improved parallel traceanon
- Updated to use new parallel API.
- Use libcrypto for AES operations.
- Rename -f option to -F to avoid confusion with normal filtering options.
- Add OO code for implementing anonymisation methods.
- Add ability to anonymise IPv6 addresses using cryptopan.
- Make sure ICMPv6 checksums are replaced.
- Remove unnecessary testing code, e.g. hash functions, debug output.
- Add maximum threads CLI option.
- Replaced useless trace_help option with conventional -h option.
|
-
Property mode set to
100644
|
File size:
1.5 KB
|
Line | |
---|
1 | #ifndef WDCAP_ANON_H |
---|
2 | #define WDCAP_ANON_H |
---|
3 | |
---|
4 | #include "config.h" |
---|
5 | #include <sys/types.h> |
---|
6 | #include <inttypes.h> |
---|
7 | |
---|
8 | |
---|
9 | class Anonymiser { |
---|
10 | public: |
---|
11 | Anonymiser(); |
---|
12 | virtual ~Anonymiser() {}; |
---|
13 | |
---|
14 | virtual uint32_t anonIPv4(uint32_t orig) = 0; |
---|
15 | virtual void anonIPv6(uint8_t *orig, uint8_t *result) = 0; |
---|
16 | |
---|
17 | }; |
---|
18 | |
---|
19 | class PrefixSub: public Anonymiser { |
---|
20 | public: |
---|
21 | PrefixSub(const char *ipv4_key, const char *ipv6_key); |
---|
22 | ~PrefixSub(); |
---|
23 | uint32_t anonIPv4(uint32_t orig); |
---|
24 | void anonIPv6(uint8_t *orig, uint8_t *result); |
---|
25 | |
---|
26 | private: |
---|
27 | uint32_t ipv4_prefix; |
---|
28 | uint32_t ipv4_mask; |
---|
29 | |
---|
30 | uint8_t ipv6_prefix[16]; |
---|
31 | uint8_t ipv6_mask[16]; |
---|
32 | |
---|
33 | }; |
---|
34 | |
---|
35 | #ifdef HAVE_LIBCRYPTO |
---|
36 | #include <openssl/evp.h> |
---|
37 | #include <map> |
---|
38 | |
---|
39 | typedef std::map<uint32_t, uint32_t> IPv4AnonCache; |
---|
40 | typedef std::map<uint64_t, uint64_t> IPv6AnonCache; |
---|
41 | |
---|
42 | class CryptoAnon : public Anonymiser { |
---|
43 | public: |
---|
44 | CryptoAnon(uint8_t *key, uint8_t len, uint8_t cachebits); |
---|
45 | ~CryptoAnon(); |
---|
46 | |
---|
47 | uint32_t anonIPv4(uint32_t orig); |
---|
48 | void anonIPv6(uint8_t *orig, uint8_t *result); |
---|
49 | |
---|
50 | |
---|
51 | private: |
---|
52 | uint8_t padding[16]; |
---|
53 | uint8_t key[16]; |
---|
54 | uint8_t cachebits; |
---|
55 | |
---|
56 | IPv4AnonCache *ipv4_cache; |
---|
57 | IPv6AnonCache *ipv6_cache; |
---|
58 | |
---|
59 | uint32_t recent_ipv4_cache[2][2]; |
---|
60 | const EVP_CIPHER *cipher; |
---|
61 | EVP_CIPHER_CTX ctx; |
---|
62 | |
---|
63 | uint32_t encrypt32Bits(uint32_t orig, uint8_t start, uint8_t stop, |
---|
64 | uint32_t res); |
---|
65 | uint64_t encrypt64Bits(uint64_t orig); |
---|
66 | uint32_t lookupv4Cache(uint32_t prefix); |
---|
67 | uint64_t lookupv6Cache(uint64_t prefix); |
---|
68 | |
---|
69 | }; |
---|
70 | #endif |
---|
71 | |
---|
72 | #endif |
---|
73 | // vim: set sw=4 tabstop=4 softtabstop=4 expandtab : |
---|
Note: See
TracBrowser
for help on using the repository browser.