From 75b6c7d983b268d8f9dd498c235888e53f1a8c5d Mon Sep 17 00:00:00 2001
From: Guillaume Valadon <guillaume@valadon.net>
Date: Mon, 2 Mar 2015 17:19:45 +0100
Subject: [PATCH] Fixes from Pierre comments

--HG--
branch : GTP support
---
 scapy/contrib/gtp.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/scapy/contrib/gtp.py b/scapy/contrib/gtp.py
index e88a7a74..3677ee7a 100644
--- a/scapy/contrib/gtp.py
+++ b/scapy/contrib/gtp.py
@@ -12,7 +12,9 @@
 import time
 import logging
 
-from scapy.all import *
+from scapy.packet import *
+from scapy.fields import *
+from scapy.layers.inet import IP, UDP
 
 # GTP Data types
 
@@ -524,6 +526,7 @@ class GTPmorethan1500(Packet):
 
 # Bind GTP-C
 bind_layers(UDP, GTPHeader, dport = 2123)
+bind_layers(UDP, GTPHeader, sport = 2123)
 bind_layers(GTPHeader, GTPEchoRequest, gtp_type = 1)
 bind_layers(GTPHeader, GTPEchoResponse, gtp_type = 2)
 bind_layers(GTPHeader, GTPCreatePDPContextRequest, gtp_type = 16)
@@ -531,9 +534,12 @@ bind_layers(GTPHeader, GTPCreatePDPContextResponse, gtp_type = 17)
 bind_layers(GTPHeader, GTPDeletePDPContextRequest, gtp_type = 20)
 bind_layers(GTPHeader, GTPDeletePDPContextResponse, gtp_type = 21)
 bind_layers(GTPHeader, GTPPDUNotificationRequest, gtp_type = 27)
+
 # Bind GTP-U
-bind_layers(UDP, GTP_U_Header)
+bind_layers(UDP, GTP_U_Header, dport = 2152)
+bind_layers(UDP, GTP_U_Header, sport = 2152)
 bind_layers(GTP_U_Header, IP, gtp_type = 255)
 
 if __name__ == "__main__":
+    from scapy.all import *
     interact(mydict=globals(), mybanner="GTPv1 add-on")
-- 
GitLab