stats: fix duplicate /if/names entry
[vpp.git] / test / patches / scapy-2.4.3 / ipsec.patch
index 9936047..196b78f 100644 (file)
@@ -1,8 +1,16 @@
 diff --git a/scapy/layers/ipsec.py b/scapy/layers/ipsec.py
-index f8c601fa..f566d288 100644
+index ae057ee1..55d0dd53 100644
 --- a/scapy/layers/ipsec.py
 +++ b/scapy/layers/ipsec.py
-@@ -359,11 +359,8 @@ class CryptAlgo(object):
+@@ -56,6 +56,7 @@ from scapy.fields import ByteEnumField, ByteField, IntField, PacketField, \
+     ShortField, StrField, XIntField, XStrField, XStrLenField
+ from scapy.packet import Packet, bind_layers, Raw
+ from scapy.layers.inet import IP, UDP
++from scapy.contrib.mpls import MPLS
+ import scapy.modules.six as six
+ from scapy.modules.six.moves import range
+ from scapy.layers.inet6 import IPv6, IPv6ExtHdrHopByHop, IPv6ExtHdrDestOpt, \
+@@ -359,11 +360,8 @@ class CryptAlgo(object):
              encryptor = cipher.encryptor()
  
              if self.is_aead:
@@ -16,7 +24,7 @@ index f8c601fa..f566d288 100644
                  data = encryptor.update(data) + encryptor.finalize()
                  data += encryptor.tag[:self.icv_size]
              else:
-@@ -401,12 +398,7 @@ class CryptAlgo(object):
+@@ -400,12 +398,7 @@ class CryptAlgo(object):
  
              if self.is_aead:
                  # Tag value check is done during the finalize method
@@ -30,7 +38,31 @@ index f8c601fa..f566d288 100644
              try:
                  data = decryptor.update(data) + decryptor.finalize()
              except InvalidTag as err:
-@@ -545,7 +537,7 @@ class AuthAlgo(object):
+@@ -445,6 +438,7 @@ if algorithms:
+     CRYPT_ALGOS['AES-CTR'] = CryptAlgo('AES-CTR',
+                                        cipher=algorithms.AES,
+                                        mode=modes.CTR,
++                                       block_size=1,
+                                        iv_size=8,
+                                        salt_size=4,
+                                        format_mode_iv=_aes_ctr_format_mode_iv)
+@@ -452,6 +446,7 @@ if algorithms:
+     CRYPT_ALGOS['AES-GCM'] = CryptAlgo('AES-GCM',
+                                        cipher=algorithms.AES,
+                                        mode=modes.GCM,
++                                       block_size=1,
+                                        salt_size=4,
+                                        iv_size=8,
+                                        icv_size=16,
+@@ -460,6 +455,7 @@ if algorithms:
+         CRYPT_ALGOS['AES-CCM'] = CryptAlgo('AES-CCM',
+                                            cipher=algorithms.AES,
+                                            mode=modes.CCM,
++                                           block_size=1,
+                                            iv_size=8,
+                                            salt_size=3,
+                                            icv_size=16,
+@@ -544,7 +540,7 @@ class AuthAlgo(object):
          else:
              return self.mac(key, self.digestmod(), default_backend())
  
@@ -39,7 +71,7 @@ index f8c601fa..f566d288 100644
          """
          Sign an IPsec (ESP or AH) packet with this algo.
  
-@@ -561,16 +553,20 @@ class AuthAlgo(object):
+@@ -560,16 +556,20 @@ class AuthAlgo(object):
  
          if pkt.haslayer(ESP):
              mac.update(raw(pkt[ESP]))
@@ -61,7 +93,7 @@ index f8c601fa..f566d288 100644
          """
          Check that the integrity check value (icv) of a packet is valid.
  
-@@ -602,6 +598,8 @@ class AuthAlgo(object):
+@@ -600,6 +600,8 @@ class AuthAlgo(object):
              clone = zero_mutable_fields(pkt.copy(), sending=False)
  
          mac.update(raw(clone))
@@ -70,7 +102,16 @@ index f8c601fa..f566d288 100644
          computed_icv = mac.finalize()[:self.icv_size]
  
          # XXX: Cannot use mac.verify because the ICV can be truncated
-@@ -864,6 +862,23 @@ class SecurityAssociation(object):
+@@ -788,7 +790,7 @@ class SecurityAssociation(object):
+     This class is responsible of "encryption" and "decryption" of IPsec packets.  # noqa: E501
+     """
+-    SUPPORTED_PROTOS = (IP, IPv6)
++    SUPPORTED_PROTOS = (IP, IPv6, MPLS)
+     def __init__(self, proto, spi, seq_num=1, crypt_algo=None, crypt_key=None,
+                  auth_algo=None, auth_key=None, tunnel_header=None, nat_t_header=None, esn_en=False, esn=0):   # noqa: E501
+@@ -862,6 +864,23 @@ class SecurityAssociation(object):
                  raise TypeError('nat_t_header must be %s' % UDP.name)
          self.nat_t_header = nat_t_header
  
@@ -94,7 +135,7 @@ index f8c601fa..f566d288 100644
      def check_spi(self, pkt):
          if pkt.spi != self.spi:
              raise TypeError('packet spi=0x%x does not match the SA spi=0x%x' %
-@@ -877,7 +892,8 @@ class SecurityAssociation(object):
+@@ -875,7 +894,8 @@ class SecurityAssociation(object):
              if len(iv) != self.crypt_algo.iv_size:
                  raise TypeError('iv length must be %s' % self.crypt_algo.iv_size)  # noqa: E501
  
@@ -104,7 +145,7 @@ index f8c601fa..f566d288 100644
  
          if self.tunnel_header:
              tunnel = self.tunnel_header.copy()
-@@ -901,7 +917,7 @@ class SecurityAssociation(object):
+@@ -899,7 +919,7 @@ class SecurityAssociation(object):
                                        esn_en=esn_en or self.esn_en,
                                        esn=esn or self.esn)
  
@@ -113,7 +154,7 @@ index f8c601fa..f566d288 100644
  
          if self.nat_t_header:
              nat_t_header = self.nat_t_header.copy()
-@@ -928,7 +944,8 @@ class SecurityAssociation(object):
+@@ -926,7 +946,8 @@ class SecurityAssociation(object):
  
      def _encrypt_ah(self, pkt, seq_num=None):
  
@@ -123,7 +164,7 @@ index f8c601fa..f566d288 100644
                  icv=b"\x00" * self.auth_algo.icv_size)
  
          if self.tunnel_header:
-@@ -968,7 +985,8 @@ class SecurityAssociation(object):
+@@ -966,7 +987,8 @@ class SecurityAssociation(object):
          else:
              ip_header.plen = len(ip_header.payload) + len(ah) + len(payload)
  
@@ -133,7 +174,7 @@ index f8c601fa..f566d288 100644
  
          # sequence number must always change, unless specified by the user
          if seq_num is None:
-@@ -1005,11 +1023,12 @@ class SecurityAssociation(object):
+@@ -1003,11 +1025,12 @@ class SecurityAssociation(object):
  
      def _decrypt_esp(self, pkt, verify=True, esn_en=None, esn=None):
  
@@ -147,7 +188,7 @@ index f8c601fa..f566d288 100644
  
          esp = self.crypt_algo.decrypt(self, encrypted, self.crypt_key,
                                        self.crypt_algo.icv_size or
-@@ -1050,9 +1069,10 @@ class SecurityAssociation(object):
+@@ -1048,9 +1071,10 @@ class SecurityAssociation(object):
  
      def _decrypt_ah(self, pkt, verify=True):
  
@@ -159,4 +200,3 @@ index f8c601fa..f566d288 100644
  
          ah = pkt[AH]
          payload = ah.payload
-