prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  L2TP post_build is broken
  ### Brief description
  
  l2tp.py post_build is supposed to update the length. However, it only does this if current length is None, and the length field is initialized to 0, not None, resulting in the length never being updated. 
  
  ### Scapy version
  
  2.4.5
  
  ### Python version
  
  3.8
  
  ### Operating system
  
  Ubuntu 20.04
  
  ### Additional environment information
  
  _No response_
  
  ### How to reproduce
  
  print( (L2TP(header=['control', 'length'], version=2) / 'blahblah').build() )
  
  
  ### Actual result
  
  b'\xc0\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00blahblah'
  
  ### Expected result
  
  b'\xc0\x02\x00\x14\x00\x00\x00\x00\x00\x00\x00\x00blahblah'
  
  ### Related resources
  
  _No response_
  
  </issue>
  <code>
  [start of scapy/layers/l2tp.py]
  1 # This file is part of Scapy
  2 # See http://www.secdev.org/projects/scapy for more information
  3 # Copyright (C) Philippe Biondi <phil@secdev.org>
  4 # This program is published under a GPLv2 license
  5 
  6 """
  7 L2TP (Layer 2 Tunneling Protocol) for VPNs.
  8 
  9 [RFC 2661]
  10 """
  11 
  12 import struct
  13 
  14 from scapy.packet import Packet, bind_layers, bind_bottom_up
  15 from scapy.fields import BitEnumField, ConditionalField, FlagsField, \
  16     PadField, ShortField
  17 from scapy.layers.inet import UDP
  18 from scapy.layers.ppp import PPP
  19 
  20 
  21 class L2TP(Packet):
  22     name = "L2TP"
  23     fields_desc = [
  24         FlagsField("hdr", 0, 12, ['res00', 'res01', 'res02', 'res03', 'priority', 'offset',  # noqa: E501
  25                                   'res06', 'sequence', 'res08', 'res09', 'length', 'control']),  # noqa: E501
  26         BitEnumField("version", 2, 4, {2: 'L2TPv2'}),
  27 
  28         ConditionalField(ShortField("len", 0),
  29                          lambda pkt: pkt.hdr & 'control+length'),
  30         ShortField("tunnel_id", 0),
  31         ShortField("session_id", 0),
  32         ConditionalField(ShortField("ns", 0),
  33                          lambda pkt: pkt.hdr & 'sequence+control'),
  34         ConditionalField(ShortField("nr", 0),
  35                          lambda pkt: pkt.hdr & 'sequence+control'),
  36         ConditionalField(
  37             PadField(ShortField("offset", 0), 4, b"\x00"),
  38             lambda pkt: not (pkt.hdr & 'control') and pkt.hdr & 'offset'
  39         )
  40     ]
  41 
  42     def post_build(self, pkt, pay):
  43         if self.len is None and self.hdr & 'control+length':
  44             tmp_len = len(pkt) + len(pay)
  45             pkt = pkt[:2] + struct.pack("!H", tmp_len) + pkt[4:]
  46         return pkt + pay
  47 
  48 
  49 bind_bottom_up(UDP, L2TP, dport=1701)
  50 bind_bottom_up(UDP, L2TP, sport=1701)
  51 bind_layers(UDP, L2TP, dport=1701, sport=1701)
  52 bind_layers(L2TP, PPP,)
  53
  [end of scapy/layers/l2tp.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/scapy/layers/l2tp.py b/scapy/layers/l2tp.py
  --- a/scapy/layers/l2tp.py
  +++ b/scapy/layers/l2tp.py
  @@ -25,7 +25,7 @@
                                     'res06', 'sequence', 'res08', 'res09', 'length', 'control']),  # noqa: E501
           BitEnumField("version", 2, 4, {2: 'L2TPv2'}),
   
  -        ConditionalField(ShortField("len", 0),
  +        ConditionalField(ShortField("len", None),
                            lambda pkt: pkt.hdr & 'control+length'),
           ShortField("tunnel_id", 0),
           ShortField("session_id", 0),
  
verification_info: {"golden_diff": "diff --git a/scapy/layers/l2tp.py b/scapy/layers/l2tp.py\n--- a/scapy/layers/l2tp.py\n+++ b/scapy/layers/l2tp.py\n@@ -25,7 +25,7 @@\n                                   'res06', 'sequence', 'res08', 'res09', 'length', 'control']),  # noqa: E501\n         BitEnumField(\"version\", 2, 4, {2: 'L2TPv2'}),\n \n-        ConditionalField(ShortField(\"len\", 0),\n+        ConditionalField(ShortField(\"len\", None),\n                          lambda pkt: pkt.hdr & 'control+length'),\n         ShortField(\"tunnel_id\", 0),\n         ShortField(\"session_id\", 0),\n", "issue": "L2TP post_build is broken\n### Brief description\n\nl2tp.py post_build is supposed to update the length. However, it only does this if current length is None, and the length field is initialized to 0, not None, resulting in the length never being updated. \n\n### Scapy version\n\n2.4.5\n\n### Python version\n\n3.8\n\n### Operating system\n\nUbuntu 20.04\n\n### Additional environment information\n\n_No response_\n\n### How to reproduce\n\nprint( (L2TP(header=['control', 'length'], version=2) / 'blahblah').build() )\r\n\n\n### Actual result\n\nb'\\xc0\\x02\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00blahblah'\n\n### Expected result\n\nb'\\xc0\\x02\\x00\\x14\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00blahblah'\n\n### Related resources\n\n_No response_\n", "before_files": [{"content": "# This file is part of Scapy\n# See http://www.secdev.org/projects/scapy for more information\n# Copyright (C) Philippe Biondi <phil@secdev.org>\n# This program is published under a GPLv2 license\n\n\"\"\"\nL2TP (Layer 2 Tunneling Protocol) for VPNs.\n\n[RFC 2661]\n\"\"\"\n\nimport struct\n\nfrom scapy.packet import Packet, bind_layers, bind_bottom_up\nfrom scapy.fields import BitEnumField, ConditionalField, FlagsField, \\\n    PadField, ShortField\nfrom scapy.layers.inet import UDP\nfrom scapy.layers.ppp import PPP\n\n\nclass L2TP(Packet):\n    name = \"L2TP\"\n    fields_desc = [\n        FlagsField(\"hdr\", 0, 12, ['res00', 'res01', 'res02', 'res03', 'priority', 'offset',  # noqa: E501\n                                  'res06', 'sequence', 'res08', 'res09', 'length', 'control']),  # noqa: E501\n        BitEnumField(\"version\", 2, 4, {2: 'L2TPv2'}),\n\n        ConditionalField(ShortField(\"len\", 0),\n                         lambda pkt: pkt.hdr & 'control+length'),\n        ShortField(\"tunnel_id\", 0),\n        ShortField(\"session_id\", 0),\n        ConditionalField(ShortField(\"ns\", 0),\n                         lambda pkt: pkt.hdr & 'sequence+control'),\n        ConditionalField(ShortField(\"nr\", 0),\n                         lambda pkt: pkt.hdr & 'sequence+control'),\n        ConditionalField(\n            PadField(ShortField(\"offset\", 0), 4, b\"\\x00\"),\n            lambda pkt: not (pkt.hdr & 'control') and pkt.hdr & 'offset'\n        )\n    ]\n\n    def post_build(self, pkt, pay):\n        if self.len is None and self.hdr & 'control+length':\n            tmp_len = len(pkt) + len(pay)\n            pkt = pkt[:2] + struct.pack(\"!H\", tmp_len) + pkt[4:]\n        return pkt + pay\n\n\nbind_bottom_up(UDP, L2TP, dport=1701)\nbind_bottom_up(UDP, L2TP, sport=1701)\nbind_layers(UDP, L2TP, dport=1701, sport=1701)\nbind_layers(L2TP, PPP,)\n", "path": "scapy/layers/l2tp.py"}]}