From 98b15034b3273427487c3bbabee2af7c8dc810e3 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Mon, 7 Jun 2010 17:05:54 +0800 Subject: GPRS: Move test script into subdirectory.. --- openbsc/contrib/gb-proxy-unblock-bug.py | 58 ---------------------------- openbsc/contrib/gprs/gb-proxy-unblock-bug.py | 58 ++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 58 deletions(-) delete mode 100755 openbsc/contrib/gb-proxy-unblock-bug.py create mode 100755 openbsc/contrib/gprs/gb-proxy-unblock-bug.py (limited to 'openbsc/contrib') diff --git a/openbsc/contrib/gb-proxy-unblock-bug.py b/openbsc/contrib/gb-proxy-unblock-bug.py deleted file mode 100755 index 0cd4b871f..000000000 --- a/openbsc/contrib/gb-proxy-unblock-bug.py +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env python - -""" -demonstrate a unblock bug on the GB Proxy.. -""" - -bts_ns_reset = "\x02\x00\x81\x01\x01\x82\x1f\xe7\x04\x82\x1f\xe7" -ns_reset_ack = "\x03\x01\x82\x1f\xe7\x04\x82\x1f\xe7" - -bts_ns_unblock = "\x06" -ns_unblock_ack = "\x07" - -bts_bvc_reset_0 = "\x00\x00\x00\x00\x22\x04\x82\x00\x00\x07\x81\x03\x3b\x81\x02" -ns_bvc_reset_0_ack = "\x00\x00\x00\x00\x23\x04\x82\x00\x00" - -bts_bvc_reset_8167 = "\x00\x00\x00\x00\x22\x04\x82\x1f\xe7\x07\x81\x08\x08\x88\x72\xf4\x80\x10\x1c\x00\x9c\x40" - - -import socket -socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) -socket.bind(("0.0.0.0", 0)) -socket.setblocking(1) - - -import sys -port = int(sys.argv[1]) -print "Sending data to port: %d" % port - -def send_and_receive(packet): - socket.sendto(packet, ("127.0.0.1", port)) - - try: - data, addr = socket.recvfrom(4096) - except socket.error, e: - print "ERROR", e - import sys - sys.exit(0) - return data - -#send stuff once - -to_send = [ - (bts_ns_reset, ns_reset_ack, "reset ack"), - (bts_ns_unblock, ns_unblock_ack, "unblock ack"), - (bts_bvc_reset_0, ns_bvc_reset_0_ack, "BVCI=0 reset ack"), -] - - -for (out, inp, type) in to_send: - res = send_and_receive(out) - if res != inp: - print "Failed to get the %s" % type - sys.exit(-1) - -import time -time.sleep(3) -res = send_and_receive(bts_bvc_reset_8167) -print "Sent all messages... check wireshark for the last response" diff --git a/openbsc/contrib/gprs/gb-proxy-unblock-bug.py b/openbsc/contrib/gprs/gb-proxy-unblock-bug.py new file mode 100755 index 000000000..0cd4b871f --- /dev/null +++ b/openbsc/contrib/gprs/gb-proxy-unblock-bug.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python + +""" +demonstrate a unblock bug on the GB Proxy.. +""" + +bts_ns_reset = "\x02\x00\x81\x01\x01\x82\x1f\xe7\x04\x82\x1f\xe7" +ns_reset_ack = "\x03\x01\x82\x1f\xe7\x04\x82\x1f\xe7" + +bts_ns_unblock = "\x06" +ns_unblock_ack = "\x07" + +bts_bvc_reset_0 = "\x00\x00\x00\x00\x22\x04\x82\x00\x00\x07\x81\x03\x3b\x81\x02" +ns_bvc_reset_0_ack = "\x00\x00\x00\x00\x23\x04\x82\x00\x00" + +bts_bvc_reset_8167 = "\x00\x00\x00\x00\x22\x04\x82\x1f\xe7\x07\x81\x08\x08\x88\x72\xf4\x80\x10\x1c\x00\x9c\x40" + + +import socket +socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) +socket.bind(("0.0.0.0", 0)) +socket.setblocking(1) + + +import sys +port = int(sys.argv[1]) +print "Sending data to port: %d" % port + +def send_and_receive(packet): + socket.sendto(packet, ("127.0.0.1", port)) + + try: + data, addr = socket.recvfrom(4096) + except socket.error, e: + print "ERROR", e + import sys + sys.exit(0) + return data + +#send stuff once + +to_send = [ + (bts_ns_reset, ns_reset_ack, "reset ack"), + (bts_ns_unblock, ns_unblock_ack, "unblock ack"), + (bts_bvc_reset_0, ns_bvc_reset_0_ack, "BVCI=0 reset ack"), +] + + +for (out, inp, type) in to_send: + res = send_and_receive(out) + if res != inp: + print "Failed to get the %s" % type + sys.exit(-1) + +import time +time.sleep(3) +res = send_and_receive(bts_bvc_reset_8167) +print "Sent all messages... check wireshark for the last response" -- cgit v1.2.3