Skip to content

Commit

Permalink
Removed printouts.
Browse files Browse the repository at this point in the history
Added divert ip/port to the starting log message.
  • Loading branch information
yurivict committed May 16, 2015
1 parent 9ee2938 commit 013e649
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions tiny-udp-anti-nat.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def update_rev(pkt):
sys.exit("Only root can run tiny-udp-anti-nat")

## starting
log('starting')
log('starting (divert-ip=%s, divert-port=%s)' % (arg_clnt_divert_ip, arg_clnt_divert_port))

## signals
tu.handle_signals(lambda msg: log(msg))
Expand All @@ -187,17 +187,16 @@ def update_rev(pkt):
while True:
(pkt, addr) = sock.recvfrom(64000, 1024)
pkt = bytearray(pkt)
print('received addr=%s' % (str(addr)))
# process
if is_dir_match(pkt):
print('replacing OLD->NEW')
#print('replacing OLD->NEW')
update_dir(pkt)
elif is_rev_match(pkt):
print('replacing NEW->OLD')
#print('replacing NEW->OLD')
update_rev(pkt)
else:
print('unknown packet received: %s:%d -> %s:%d' % (unpack_ip_src(pkt), unpack_port_src(pkt), unpack_ip_dst(pkt), unpack_port_dst(pkt)))
print('... dst-ip-old=%s' % (arg_ip_old))
log('unknown packet received: %s:%d -> %s:%d' % (unpack_ip_src(pkt), unpack_port_src(pkt), unpack_ip_dst(pkt), unpack_port_dst(pkt)))
log('... dst-ip-old=%s' % (arg_ip_old))
# recompute checksum
nc.checksum_calc_udp_packet(pkt)
# send further
Expand Down

0 comments on commit 013e649

Please sign in to comment.