Skip to content
Snippets Groups Projects
Commit 60190404 authored by Guillaume Valadon's avatar Guillaume Valadon
Browse files

Fix Radius building

parent 803aa56a
No related branches found
No related tags found
No related merge requests found
...@@ -78,14 +78,14 @@ class RadiusAttribute(Packet): ...@@ -78,14 +78,14 @@ class RadiusAttribute(Packet):
94:"Originating-Line-Info", 94:"Originating-Line-Info",
101:"Error-Cause" 101:"Error-Cause"
}), }),
FieldLenField("len",None,"value","B", adjust=lambda pkt,x:x+2), FieldLenField("len", None, "value", "B", adjust=lambda pkt,x:len(pkt.value)+2),
StrLenField("value",None,length_from= lambda pkt:pkt.len-2),] StrLenField("value", "" , length_from=lambda pkt:pkt.len-2),]
def post_build(self, p, pay): def post_build(self, p, pay):
l = self.len l = self.len
if l is None: if l is None:
l = len(p) l = len(p)
p = p[:2]+struct.pack("!B",l)+p[4:] p = p[:1]+struct.pack("!B", l)+p[2:]
return p return p
def extract_padding(self, pay): def extract_padding(self, pay):
...@@ -132,7 +132,7 @@ class Radius(Packet): ...@@ -132,7 +132,7 @@ class Radius(Packet):
254: "Reserved", 254: "Reserved",
255: "Reserved"} ), 255: "Reserved"} ),
ByteField("id", 0), 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), StrFixedLenField("authenticator","",16),
PacketListField("attributes", [], RadiusAttribute, length_from=lambda pkt:pkt.len-20) ] PacketListField("attributes", [], RadiusAttribute, length_from=lambda pkt:pkt.len-20) ]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment