diff options
author | Frediano Ziglio <fziglio@redhat.com> | 2016-07-27 17:13:42 +0100 |
---|---|---|
committer | Frediano Ziglio <fziglio@redhat.com> | 2016-07-27 17:13:42 +0100 |
commit | 48a1c146116f7695a8cb7e19d2155cca87156490 (patch) | |
tree | 683717d9dd13b516464a01bcdd4d92737251a449 | |
parent | 965eb5a615fe0f7f2a2526fca8cd2ba230a6626d (diff) |
use an IP macro to make easier to understand the constant ip used
-rw-r--r-- | tun.c | 2 | ||||
-rw-r--r-- | utils.h | 2 |
2 files changed, 3 insertions, 1 deletions
@@ -243,7 +243,7 @@ handle_tun(void) struct iphdr *ip = (struct iphdr *) pkt->data; if (ip->version != IPVERSION) continue; - flow = &flows[ip->daddr == htonl(0xc0a87f00)]; + flow = &flows[ip->daddr == htonl(IP(192,168,127,0))]; uint64_t curr_time = get_time_us(); uint64_t time_to_send; @@ -4,6 +4,8 @@ #define MAX(a,b) ((a) > (b) ? (a) : (b)) #define MIN(a,b) ((a) < (b) ? (a) : (b)) +#define IP(a,b,c,d) ((a)*0x1000000u+(b)*0x10000u+(c)*0x100u+(d)*1u) + void set_nonblocking(int sock); void set_nodelay(int fd); void write_all(int fd, const void *buf, size_t buf_size); |