… | |
… | |
51 | } |
51 | } |
52 | }; |
52 | }; |
53 | |
53 | |
54 | static struct ether_emu ether_emu; |
54 | static struct ether_emu ether_emu; |
55 | |
55 | |
56 | bool |
56 | bool |
57 | ether_emu::tun_to_tap (tap_packet *pkt) |
57 | ether_emu::tun_to_tap (tap_packet *pkt) |
58 | { |
58 | { |
59 | int dst; |
59 | int dst; |
60 | |
60 | |
61 | if (pkt->is_ipv4 ()) |
61 | if (pkt->is_ipv4 ()) |
… | |
… | |
97 | id2mac (dst, pkt->dst); |
97 | id2mac (dst, pkt->dst); |
98 | |
98 | |
99 | return true; |
99 | return true; |
100 | } |
100 | } |
101 | |
101 | |
102 | bool |
102 | bool |
103 | ether_emu::tap_to_tun (tap_packet *pkt) |
103 | ether_emu::tap_to_tun (tap_packet *pkt) |
104 | { |
104 | { |
105 | if (pkt->is_arp ()) |
105 | if (pkt->is_arp ()) |
106 | { |
106 | { |
107 | u32 ip_src = *(u32 *)&(*pkt)[28]; |
107 | u32 ip_src = *(u32 *)&(*pkt)[28]; |