aboutsummaryrefslogtreecommitdiffstats
path: root/test/vpp_pppoe_interface.py
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2022-05-20 16:01:22 +0200
committerOle Tr�an <otroan@employees.org>2022-09-26 08:14:29 +0000
commitfe45f8f5afbf34d68cf992cc32b12432a82cdb38 (patch)
treeae8126e78d184022ef97007e64ac1f3350537a40 /test/vpp_pppoe_interface.py
parentb70497124840fb6d9e8e5cf7239a41cb2bc7013c (diff)
api: replace print functions wth format
Type: improvement Change-Id: I7f7050c19453a69a7fb6c5e62f8f57db847d9144 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'test/vpp_pppoe_interface.py')
0 files changed, 0 insertions, 0 deletions
.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
diff --git a/scapy/layers/inet6.py b/scapy/layers/inet6.py
index 6f9f16b..d61c621 100644
--- a/scapy/layers/inet6.py
+++ b/scapy/layers/inet6.py
@@ -1089,9 +1089,9 @@ class IPv6ExtHdrSegmentRouting(_IPv6ExtHdr):
                     BitField("unused2", 0, 3),
                     ShortField("tag", 0),
                     IP6ListField("addresses", ["::1"],
-                        count_from=lambda pkt: pkt.lastentry),
+                        count_from=lambda pkt: pkt.lastentry+1),
                     PacketListField("tlv_objects", [], IPv6ExtHdrSegmentRoutingTLV,
-                        length_from=lambda pkt: 8*pkt.len - 16*pkt.lastentry) ]
+                        length_from=lambda pkt: 8*pkt.len - 16*(pkt.lastentry+1)) ]
 
     overload_fields = { IPv6: { "nh": 43 } }
 
@@ -1119,7 +1119,10 @@ class IPv6ExtHdrSegmentRouting(_IPv6ExtHdr):
             pkt = pkt[:3] + struct.pack("B", tmp_len) + pkt[4:]
 
         if self.lastentry is None:
-            pkt = pkt[:4] + struct.pack("B", len(self.addresses)) + pkt[5:]
+            tmp_len = len(self.addresses)
+            if tmp_len:
+                tmp_len -= 1
+            pkt = pkt[:4] + struct.pack("B", tmp_len) + pkt[5:]
 
         return _IPv6ExtHdr.post_build(self, pkt, pay)