From 601904044df49c543b7c90df7adac50110c8717d Mon Sep 17 00:00:00 2001 From: Guillaume Valadon <guillaume.valadon@ssi.gouv.fr> Date: Fri, 13 Jan 2017 13:55:10 +0100 Subject: [PATCH] Fix Radius building --- scapy/layers/radius.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scapy/layers/radius.py b/scapy/layers/radius.py index 2a5a71a8..4d93bcff 100644 --- a/scapy/layers/radius.py +++ b/scapy/layers/radius.py @@ -78,14 +78,14 @@ class RadiusAttribute(Packet): 94:"Originating-Line-Info", 101:"Error-Cause" }), - FieldLenField("len",None,"value","B", adjust=lambda pkt,x:x+2), - StrLenField("value",None,length_from= lambda pkt:pkt.len-2),] + FieldLenField("len", None, "value", "B", adjust=lambda pkt,x:len(pkt.value)+2), + StrLenField("value", "" , length_from=lambda pkt:pkt.len-2),] def post_build(self, p, pay): l = self.len if l is None: l = len(p) - p = p[:2]+struct.pack("!B",l)+p[4:] + p = p[:1]+struct.pack("!B", l)+p[2:] return p def extract_padding(self, pay): @@ -132,7 +132,7 @@ class Radius(Packet): 254: "Reserved", 255: "Reserved"} ), ByteField("id", 0), - FieldLenField("len", None, "attributes", "H" , adjust= lambda pkt,x:len(x.value_pair)+20), + FieldLenField("len", None, "attributes", "H" , adjust=lambda pkt,x:len(pkt.attributes)+20), StrFixedLenField("authenticator","",16), PacketListField("attributes", [], RadiusAttribute, length_from=lambda pkt:pkt.len-20) ] -- GitLab