diff --git a/doc/scapy/advanced_usage.rst b/doc/scapy/advanced_usage.rst
index ae9129827146b4bbfef5b78f4fb008a21aba514b..71771bd839dfaa3a6312521f7244094c7db4585f 100644
--- a/doc/scapy/advanced_usage.rst
+++ b/doc/scapy/advanced_usage.rst
@@ -12,7 +12,7 @@ What is ASN.1?
 
    This is only my view on ASN.1, explained as simply as possible. For more theoretical or academic views, I'm sure you'll find better on the Internet.
 
-ASN.1 is a notation whose goal is to specify formats for data exchange. It is independant of the way data is encoded. Data encoding is specified in Encoding Rules.
+ASN.1 is a notation whose goal is to specify formats for data exchange. It is independent of the way data is encoded. Data encoding is specified in Encoding Rules.
 
 The most used encoding rules are BER (Basic Encoding Rules) and DER (Distinguished Encoding Rules). Both look the same, but the latter is specified to guarantee uniqueness of encoding. This property is quite interesting when speaking about cryptography, hashes and signatures.
 
@@ -739,7 +739,7 @@ When the automaton switches to a given state, the state's method is executed. Th
 Decorator for actions
 ~~~~~~~~~~~~~~~~~~~~~
 
-Actions are methods that are decorated by the return of ``ATMT.action`` function. This function takes the transition method it is bound to as first parameter and an optionnal priority ``prio`` as a second parameter. Default priority is 0. An action method can be decorated many times to be bound to many transitions.
+Actions are methods that are decorated by the return of ``ATMT.action`` function. This function takes the transition method it is bound to as first parameter and an optional priority ``prio`` as a second parameter. Default priority is 0. An action method can be decorated many times to be bound to many transitions.
 
 ::
 
diff --git a/doc/scapy/build_dissect.rst b/doc/scapy/build_dissect.rst
index b5743cafb676288e6496a2ed39ac29504761d194..9add39bab2eb609077af101e2041324120974c76 100644
--- a/doc/scapy/build_dissect.rst
+++ b/doc/scapy/build_dissect.rst
@@ -26,10 +26,10 @@ of a field class::
 In this example, our layer has three fields. The first one is an 2 byte integer 
 field named ``mickey`` and whose default value is 5. The second one is a 1 byte 
 integer field named ``minnie`` and whose default value is 3. The difference between 
-a vanilla ``ByteField`` and a ``XByteField`` is only the fact that the prefered human 
+a vanilla ``ByteField`` and a ``XByteField`` is only the fact that the preferred human 
 representation of the field’s value is in hexadecimal. The last field is a 4 byte 
 integer field named ``donald``. It is different from a vanilla ``IntField`` by the fact 
-that some of the possible values of the field have litterate representations. For 
+that some of the possible values of the field have literate representations. For 
 example, if it is worth 3, the value will be displayed as angry. Moreover, if the 
 "cool" value is assigned to this field, it will understand that it has to take the 
 value 2. 
@@ -941,7 +941,7 @@ Variable length fields
 
 This is about how fields that have a variable length can be handled with Scapy. These fields usually know their length from another field. Let's call them varfield and lenfield. The idea is to make each field reference the other so that when a packet is dissected, varfield can know its length from lenfield when a packet is assembled, you don't have to fill lenfield, that will deduce its value directly from varfield value.
 
-Problems arise whe you realize that the relation between lenfield and varfield is not always straightforward. Sometimes, lenfield indicates a length in bytes, sometimes a number of objects. Sometimes the length includes the header part, so that you must substract the fixed header length to deduce the varfield length. Sometimes the length is not counted in bytes but in 16bits words. Sometimes the same lenfield is used by two different varfields. Sometimes the same varfield is referenced by two lenfields, one in bytes one in 16bits words.
+Problems arise when you realize that the relation between lenfield and varfield is not always straightforward. Sometimes, lenfield indicates a length in bytes, sometimes a number of objects. Sometimes the length includes the header part, so that you must subtract the fixed header length to deduce the varfield length. Sometimes the length is not counted in bytes but in 16bits words. Sometimes the same lenfield is used by two different varfields. Sometimes the same varfield is referenced by two lenfields, one in bytes one in 16bits words.
 
  
 The length field
@@ -966,7 +966,7 @@ The variable length field
 
 A varfield can be: ``StrLenField``, ``PacketLenField``, ``PacketListField``, ``FieldListField``, ...
 
-For the two firsts, whe a packet is being dissected, their lengths are deduced from a lenfield already dissected. The link is done using the ``length_from`` parameter, which takes a function that, applied to the partly dissected packet, returns the length in bytes to take for the field. For instance::
+For the two firsts, when a packet is being dissected, their lengths are deduced from a lenfield already dissected. The link is done using the ``length_from`` parameter, which takes a function that, applied to the partly dissected packet, returns the length in bytes to take for the field. For instance::
 
     StrLenField("the_varfield", "the_default_value", length_from = lambda pkt: pkt.the_lenfield)
 
diff --git a/doc/scapy/extending.rst b/doc/scapy/extending.rst
index 6be0bd0d94e4c4b705be5c6f4befa64bfcbeb754..95ed628ebd3cbdd6a5c4e61dc81838c2911cd178 100644
--- a/doc/scapy/extending.rst
+++ b/doc/scapy/extending.rst
@@ -22,7 +22,7 @@ This first example take an IP or a name as first parameter, send an ICMP echo re
     if p:
         p.show()
 
-This is a more complex example which does an ARP ping and reports what it found with LaTeX formating::
+This is a more complex example which does an ARP ping and reports what it found with LaTeX formatting::
 
     #! /usr/bin/env python
     # arping2tex : arpings a network and outputs a LaTeX table as a result
diff --git a/doc/scapy/installation.rst b/doc/scapy/installation.rst
index 7ac9ef7a8b7982e6062ae55def737b24412333d9..2e103cdc853dfeb8eaadb0ab13c81351e014ecde 100644
--- a/doc/scapy/installation.rst
+++ b/doc/scapy/installation.rst
@@ -11,7 +11,7 @@ Overview
  1. Download and install *Scapy*.
  2. (For non-Linux platforms): Install *libpcap and libdnet* and their Python wrappers.
  3. (Optional): Install *additional software* for special features.
- 4. Run Scapy with root priviledges.
+ 4. Run Scapy with root privileges.
  
 Each of these steps can be done in a different way dependent on your platform and on the version of Scapy you want to use. 
 
@@ -147,7 +147,7 @@ Here are the topics involved and some examples that you can use to try if your i
      >>> p=IP()/ICMP()
      >>> p.pdfdump("test.pdf") 
  
-* Graphs. ``conversations()`` needs `Grapviz <http://www.graphviz.org/>`_ and `ImageMagick <http://www.imagemagick.org/>`_.
+* Graphs. ``conversations()`` needs `Graphviz <http://www.graphviz.org/>`_ and `ImageMagick <http://www.imagemagick.org/>`_.
  
   .. code-block:: python
 
@@ -395,7 +395,7 @@ For your convenience direct links are given to the versions I used (for Python 2
 
 After all packages are installed, open a command prompt (cmd.exe) and run Scapy by typing ``scapy``. If you have set the PATH correctly, this will find a little batch file in your ``C:\Python26\Scripts`` directory and instruct the Python interpreter to load Scapy.
 
-If really nothing seems to work, consider skipping the Windows version and using Scapy from a Linux Live CD -- either in a virtual machine on your Windows host or by booting from CDROM: An older version of Scapy is already included in grml and BackTrack for example. While using the Live CD you can easily upgrade to the lastest Scapy version by typing ``cd /tmp && wget scapy.net``.
+If really nothing seems to work, consider skipping the Windows version and using Scapy from a Linux Live CD -- either in a virtual machine on your Windows host or by booting from CDROM: An older version of Scapy is already included in grml and BackTrack for example. While using the Live CD you can easily upgrade to the latest Scapy version by typing ``cd /tmp && wget scapy.net``.
 
 Optional packages
 ^^^^^^^^^^^^^^^^^
diff --git a/doc/scapy/introduction.rst b/doc/scapy/introduction.rst
index 7c4c66ccb94681b8739adc27f5ac091bbca3866f..581c8b34ada79e774a8c9b1c42c2d2e50c22d20a 100644
--- a/doc/scapy/introduction.rst
+++ b/doc/scapy/introduction.rst
@@ -30,7 +30,7 @@ On top of this can be build more high level functions, for example one that does
 What makes Scapy so special
 ===========================
 
-First, with most other networking tools, you won't build someting the author did not imagine. These tools have been built for a specific goal and can't deviate much from it. For example, an ARP cache poisoning program won't let you use double 802.1q encapsulation. Or try to find a program that can send, say, an ICMP packet with padding (I said *padding*, not *payload*, see?). In fact, each time you have a new need, you have to build a new tool.
+First, with most other networking tools, you won't build something the author did not imagine. These tools have been built for a specific goal and can't deviate much from it. For example, an ARP cache poisoning program won't let you use double 802.1q encapsulation. Or try to find a program that can send, say, an ICMP packet with padding (I said *padding*, not *payload*, see?). In fact, each time you have a new need, you have to build a new tool.
 
 Second, they usually confuse decoding and interpreting. Machines are good at decoding and can help human beings with that. Interpretation is reserved to human beings. Some programs try to mimic this behaviour. For instance they say "*this port is open*" instead of "*I received a SYN-ACK*". Sometimes they are right. Sometimes not. It's easier for beginners, but when you know what you're doing, you keep on trying to deduce what really happened from the program's interpretation to make your own, which is hard because you lost a big amount of information. And you often end up using ``tcpdump -xX`` to decode and interpret what the tool missed.
 
@@ -199,7 +199,7 @@ For a quick start, here's an overview of Python's data types:
 * ``list`` (mutable): ``[4,2,"1"]`` 
 * ``dict` (mutable): ``{ "one":1 , "two":2 }``
 
-There are no block delimiters in Python. Instead, indendation does matter::
+There are no block delimiters in Python. Instead, indentation does matter::
 
     if cond:
         instr
diff --git a/doc/scapy/troubleshooting.rst b/doc/scapy/troubleshooting.rst
index eaa71282030def1a6ebb70188efbac915e0ab64b..810eea8477d12c92078705f39a381133e7a3454e 100644
--- a/doc/scapy/troubleshooting.rst
+++ b/doc/scapy/troubleshooting.rst
@@ -12,7 +12,7 @@ The kernel is not aware of what Scapy is doing behind his back. If Scapy sends a
 I can't ping 127.0.0.1. Scapy does not work with 127.0.0.1 or on the loopback interface 
 ---------------------------------------------------------------------------------------
 
-The loopback interface is a very special interface. Packets going through it are not really assembled and dissassembled. The kernel routes the packet to its destination while it is still stored an internal structure. What you see with tcpdump -i lo is only a fake to make you think everything is normal. The kernel is not aware of what Scapy is doing behind his back, so what you see on the loopback interface is also a fake. Except this one did not come from a local structure. Thus the kernel will never receive it.
+The loopback interface is a very special interface. Packets going through it are not really assembled and disassembled. The kernel routes the packet to its destination while it is still stored an internal structure. What you see with tcpdump -i lo is only a fake to make you think everything is normal. The kernel is not aware of what Scapy is doing behind his back, so what you see on the loopback interface is also a fake. Except this one did not come from a local structure. Thus the kernel will never receive it.
 
 In order to speak to local applications, you need to build your packets one layer upper, using a PF_INET/SOCK_RAW socket instead of a PF_PACKET/SOCK_RAW (or its equivalent on other systems that Linux)::
 
@@ -32,7 +32,7 @@ traceroute() does not work. I'm on a ppp link
 
 This is a known bug. See BPF filters do not work. I'm on a ppp link
 
-To work arround this, use ``nofilter=1``::
+To work around this, use ``nofilter=1``::
 
     >>> traceroute("target", nofilter=1)
 
@@ -66,4 +66,4 @@ There's a low traffic mailing list at ``scapy.ml(at)secdev.org``  (`archive <htt
 
 
 
-To avoid spam, you must subscribe to the mailing list to post.
\ No newline at end of file
+To avoid spam, you must subscribe to the mailing list to post.
diff --git a/doc/scapy/usage.rst b/doc/scapy/usage.rst
index ffc40106dbe6d96a7a1a694ae2559203581d467a..a309337e472546a6081a272b4cea17c703267404 100644
--- a/doc/scapy/usage.rst
+++ b/doc/scapy/usage.rst
@@ -152,7 +152,7 @@ str(pkt)                  assemble the packet
 hexdump(pkt)              have an hexadecimal dump 
 ls(pkt)                   have the list of fields values 
 pkt.summary()             for a one-line summary 
-pkt.show()                for a developped view of the packet 
+pkt.show()                for a developed view of the packet 
 pkt.show2()               same as show but on the assembled packet (checksum is calculated, for instance) 
 pkt.sprintf()             fills a format string with fields values of the packet 
 pkt.decode_payload_as()   changes the way the payload is decoded 
@@ -166,7 +166,7 @@ pkt.command()             return a Scapy command that can generate the packet
 Generating sets of packets
 --------------------------
 
-For the moment, we have only generated one packet. Let see how to specify sets of packets as easily. Each field of the whole packet (ever layers) can be a set. This implicidely define a set of packets, generated using a kind of cartesian product between all the fields.
+For the moment, we have only generated one packet. Let see how to specify sets of packets as easily. Each field of the whole packet (ever layers) can be a set. This implicitly define a set of packets, generated using a kind of cartesian product between all the fields.
 
 ::
 
@@ -201,7 +201,7 @@ Command          Effect
 summary()        displays a list of summaries of each packet 
 nsummary()       same as previous, with the packet number 
 conversations()  displays a graph of conversations 
-show()           displays the prefered representation (usually nsummary()) 
+show()           displays the preferred representation (usually nsummary()) 
 filter()         returns a packet list filtered with a lambda function 
 hexdump()        returns a hexdump of all packets 
 hexraw()         returns a hexdump of the Raw layer of all packets 
@@ -243,7 +243,7 @@ Fuzzing
 .. index::
    single: fuzz(), fuzzing
 
-The function fuzz() is able to change any default value that is not to be calculated (like checksums) by an object whose value is random and whose type is adapted to the field. This enables to quicky built fuzzing templates and send them in loop. In the following example, the IP layer is normal, and the UDP and NTP layers are fuzzed. The UDP checksum will be correct, the UDP destination port will be overloaded by NTP to be 123 and the NTP version will be forced to be 4. All the other ports will be randomized::
+The function fuzz() is able to change any default value that is not to be calculated (like checksums) by an object whose value is random and whose type is adapted to the field. This enables to quickly built fuzzing templates and send them in loop. In the following example, the IP layer is normal, and the UDP and NTP layers are fuzzed. The UDP checksum will be correct, the UDP destination port will be overloaded by NTP to be 123 and the NTP version will be forced to be 4. All the other ports will be randomized::
 
     >>> send(IP(dst="target")/fuzz(UDP()/NTP(version=4)),loop=1)
     ................^C
@@ -349,7 +349,7 @@ Classic SYN Scan can be initialized by executing the following command from Scap
 
     >>> sr1(IP(dst="72.14.207.99")/TCP(dport=80,flags="S"))
 
-The above will send a single SYN packet to Google's port 80 and will quit after receving a single response::
+The above will send a single SYN packet to Google's port 80 and will quit after receiving a single response::
 
     Begin emission:
     .Finished to send 1 packets.
@@ -638,7 +638,7 @@ We can sniff and do passive OS fingerprinting::
     (0.875, ['Linux 2.4.2 - 2.4.14 (1)', 'Linux 2.4.10 (1)', 'Windows 98 (?)'])
     (1.0, ['Windows 2000 (9)'])
 
-The number before the OS guess is the accurracy of the guess.
+The number before the OS guess is the accuracy of the guess.
 
 Filters
 -------
@@ -677,7 +677,7 @@ Send and receive in a loop
 .. index::
    single: srloop()
 
-Here is an example of a (h)ping-like functionnality : you always send the same set of packets to see if something change::
+Here is an example of a (h)ping-like functionality : you always send the same set of packets to see if something change::
 
     >>> srloop(IP(dst="www.target.com/30")/TCP())
     RECV 1: Ether / IP / TCP 192.168.11.99:80 > 192.168.8.14:20 SA / Padding
@@ -878,7 +878,7 @@ Routing
 .. index::
    single: Routing, conf.route
 
-Now scapy has its own routing table, so that you can have your packets routed diffrently than the system::
+Now scapy has its own routing table, so that you can have your packets routed differently than the system::
 
     >>> conf.route
     Network         Netmask         Gateway         Iface
@@ -1089,7 +1089,7 @@ Similarly, filtered ports can be found with unanswered packets::
 Xmas Scan
 ---------
 
-Xmas Scan can be launced using the following command::
+Xmas Scan can be launched using the following command::
 
     >>> ans,unans = sr(IP(dst="192.168.1.1")/TCP(dport=666,flags="FPU") )
 
@@ -1356,7 +1356,7 @@ Identifying rogue DHCP servers on your LAN
 Problem
 ^^^^^^^
 
-You suspect that someone has installed an additional, unauthorized DHCP server on your LAN -- either unintentiously or maliciously. 
+You suspect that someone has installed an additional, unauthorized DHCP server on your LAN -- either unintentionally or maliciously. 
 Thus you want to check for any active DHCP servers and identify their IP and MAC addresses.  
 
 Solution
diff --git a/scapy/arch/__init__.py b/scapy/arch/__init__.py
index 23e1cb7ce655df563bbe01bbfe596d850d942d9c..7d231148656514d22b9fb188cb90e693873242f5 100644
--- a/scapy/arch/__init__.py
+++ b/scapy/arch/__init__.py
@@ -52,6 +52,7 @@ SOLARIS=sys.platform.startswith("sunos")
 WINDOWS=sys.platform.startswith("win32")
 
 X86_64 = not WINDOWS and (os.uname()[4] == 'x86_64')
+ARM_64 = not WINDOWS and (os.uname()[4] == 'aarch64')
 
 
 # Next step is to import following architecture specific functions:
diff --git a/scapy/arch/linux.py b/scapy/arch/linux.py
index 40fcffd3660dc1793a75464dae23b014c03a25e8..222cd0119139cef482bdaf09cf3f8f7e75ac6737 100644
--- a/scapy/arch/linux.py
+++ b/scapy/arch/linux.py
@@ -132,7 +132,7 @@ def attach_filter(s, filter):
 
     # XXX. Argl! We need to give the kernel a pointer on the BPF,
     # python object header seems to be 20 bytes. 36 bytes for x86 64bits arch.
-    if scapy.arch.X86_64:
+    if scapy.arch.X86_64 or scapy.arch.ARM_64:
         bpfh = struct.pack("HL", nb, id(bpf)+36)
     else:
         bpfh = struct.pack("HI", nb, id(bpf)+20)  
@@ -282,7 +282,7 @@ def get_if(iff,cmd):
 def get_if_index(iff):
     return int(struct.unpack("I",get_if(iff, SIOCGIFINDEX)[16:20])[0])
 
-if os.uname()[4] == 'x86_64':
+if os.uname()[4] in [ 'x86_64', 'aarch64' ]:
     def get_last_packet_timestamp(sock):
         ts = ioctl(sock, SIOCGSTAMP, "1234567890123456")
         s,us = struct.unpack("QQ",ts)
diff --git a/scapy/contrib/isis.py b/scapy/contrib/isis.py
index 1fb5dde6c0c1a2435d4d3ca4d4d5fe46bdc569b6..f1631c2580ec79f4188787116cf228c0588c1574 100644
--- a/scapy/contrib/isis.py
+++ b/scapy/contrib/isis.py
@@ -5,7 +5,7 @@
     IS-IS Scapy Extension
     ~~~~~~~~~~~~~~~~~~~~~
 
-    :copyright: 2014 BENOCS GmbH, Berlin (Germany)
+    :copyright: 2014, 2015 BENOCS GmbH, Berlin (Germany)
     :author:    Marcel Patzlaff, mpatzlaff@benocs.com
     :license:   GPLv2
 
@@ -23,7 +23,7 @@
 
         This module provides Scapy layers for the Intermediate System
         to Intermediate System routing protocol as defined in RFC 1195.
-        
+
         Currently it (partially) supports the packaging/encoding
         requirements of the following RFCs:
          * RFC 1195 (only the TCP/IP related part)
@@ -33,7 +33,7 @@
          * RFC 5303 (three-way handshake)
          * RFC 5304 (cryptographic authentication)
          * RFC 5308 (routing IPv6 with IS-IS)
-                
+
     :TODO:
 
         - packet relations (requests, responses)
@@ -50,7 +50,7 @@ import struct
 from scapy.config import conf
 from scapy.fields import Field, FlagsField, ByteField, ByteEnumField, \
     FieldLenField, ShortField, PacketListField, XIntField, \
-    XShortField, ConditionalField, X3BytesField, IntField, BitField, IPField, \
+    XShortField, ConditionalField, ThreeBytesField, IntField, BitField, IPField, \
     FieldListField, MACField, BitFieldLenField, IPPrefixField, IP6PrefixField,\
     BoundStrLenField
 from scapy.layers.clns import network_layer_protocol_ids, register_cln_protocol
@@ -63,53 +63,60 @@ import random
 
 EXT_VERSION = "v0.0.1"
 
-conf.debug_dissector= True
+conf.debug_dissector = True
+
 
 #######################################################################
 ##  ISIS Utilities + Fields                                          ##
 #######################################################################
-
 def isis_area2str(area):
     return "".join(x.decode("hex") for x in area.split("."))
 
+
 def isis_str2area(s):
     if len(s) == 0:
         return ""
-    
-    numbytes= len(s[1:])
-    fmt= "%02X" + (".%02X%02X" * (numbytes / 2)) + ("" if (numbytes % 2) == 0 else ".%02X")
-    return fmt % tuple(map(ord,s))
+
+    numbytes = len(s[1:])
+    fmt = "%02X" + (".%02X%02X" * (numbytes / 2)) + ("" if (numbytes % 2) == 0 else ".%02X")
+    return fmt % tuple(map(ord, s))
+
 
 def isis_sysid2str(sysid):
     return "".join(x.decode("hex") for x in sysid.split("."))
 
+
 def isis_str2sysid(s):
     return ("%02X%02X."*3)[:-1] % tuple(map(ord, s))
 
+
 def isis_nodeid2str(nodeid):
     return "%s%s" % (isis_sysid2str(nodeid[:-3]), nodeid[-2:].decode("hex"))
-    
+
+
 def isis_str2nodeid(s):
     return "%s.%02X" % (isis_str2sysid(s[:-1]), ord(s[-1]))
 
+
 def isis_lspid2str(lspid):
     return "%s%s" % (isis_nodeid2str(lspid[:-3]), lspid[-2:].decode("hex"))
-    
+
+
 def isis_str2lspid(s):
     return "%s-%02X" % (isis_str2nodeid(s[:-1]), ord(s[-1]))
 
 
 class _ISIS_IdFieldBase(Field):
     def __init__(self, name, default, length, to_str, to_id):
-        self.to_str= to_str
-        self.to_id= to_id
-        self.length= length
-        Field.__init__(self, name, default, "%is" %length)
+        self.to_str = to_str
+        self.to_id = to_id
+        self.length = length
+        Field.__init__(self, name, default, "%is" % length)
 
     def i2m(self, pkt, x):
         if x is None:
             return "\0"*self.length
-        
+
         return self.to_str(x)
 
     def m2i(self, pkt, x):
@@ -124,52 +131,53 @@ class _ISIS_IdFieldBase(Field):
 
 class _ISIS_RandId(RandString):
     def __init__(self, template):
-        self.bytecount= template.count("*")
-        self.format=template.replace("*","%02X")
-    
+        self.bytecount = template.count("*")
+        self.format = template.replace("*", "%02X")
+
     def _fix(self):
         if self.bytecount == 0:
             return ""
-        
-        val=()
-        
+
+        val = ()
+
         for _ in range(self.bytecount):
-            val+= (RandByte(),)
-        
+            val += (RandByte(),)
+
         return self.format % val
 
+
 class _ISIS_RandAreaId(_ISIS_RandId):
     def __init__(self, bytecount= None):
-        self.bytecount= random.randint(1,13) if bytecount is None else bytecount
-        self.format= "%02X" + (".%02X%02X" * ((self.bytecount-1) / 2)) + ("" if ((self.bytecount-1) % 2) == 0 else ".%02X")
+        self.bytecount = random.randint(1, 13) if bytecount is None else bytecount
+        self.format = "%02X" + (".%02X%02X" * ((self.bytecount-1) / 2)) + ("" if ((self.bytecount-1) % 2) == 0 else ".%02X")
 
 
 class ISIS_AreaIdField(Field):
     def __init__(self, name, default, length_from):
         Field.__init__(self, name, default)
         self.length_from= length_from
-        
+
     def i2m(self, pkt, x):
         return isis_area2str(x)
-    
+
     def m2i(self, pkt, x):
         return isis_str2area(x)
-    
+
     def i2len(self, pkt, x):
         if x is None:
             return 0
-        l= len(x)
+        l = len(x)
         # l/5 is the number of dots in the Area ID
         return (l - (l / 5)) / 2
-        
+
     def addfield(self, pkt, s, val):
-        sval= self.i2m(pkt, val)
+        sval = self.i2m(pkt, val)
         return s+struct.pack("!%is" % len(sval), sval)
-    
+
     def getfield(self, pkt, s):
-        numbytes= self.length_from(pkt)
+        numbytes = self.length_from(pkt)
         return s[numbytes:], self.m2i(pkt, struct.unpack("!%is" % numbytes, s[:numbytes])[0])
-    
+
     def randval(self):
         return _ISIS_RandAreaId()
 
@@ -177,7 +185,7 @@ class ISIS_AreaIdField(Field):
 class ISIS_SystemIdField(_ISIS_IdFieldBase):
     def __init__(self, name, default):
         _ISIS_IdFieldBase.__init__(self, name, default, 6, isis_sysid2str, isis_str2sysid)
-        
+
     def randval(self):
         return _ISIS_RandId("**.**.**")
 
@@ -185,7 +193,7 @@ class ISIS_SystemIdField(_ISIS_IdFieldBase):
 class ISIS_NodeIdField(_ISIS_IdFieldBase):
     def __init__(self, name, default):
         _ISIS_IdFieldBase.__init__(self, name, default, 7, isis_nodeid2str, isis_str2nodeid)
-        
+
     def randval(self):
         return _ISIS_RandId("**.**.**.*")
 
@@ -193,89 +201,88 @@ class ISIS_NodeIdField(_ISIS_IdFieldBase):
 class ISIS_LspIdField(_ISIS_IdFieldBase):
     def __init__(self, name, default):
         _ISIS_IdFieldBase.__init__(self, name, default, 8, isis_lspid2str, isis_str2lspid)
-        
+
     def randval(self):
         return _ISIS_RandId("**.**.**.*-*")
 
 
 class ISIS_CircuitTypeField(FlagsField):
-    def __init__(self, name="circuittype", default=2, size=8, names=["L1", "L2", "r0", "r1", "r2", "r3", "r4", "r5"]):
+    def __init__(self, name="circuittype", default=2, size=8,
+                 names=["L1", "L2", "r0", "r1", "r2", "r3", "r4", "r5"]):
         FlagsField.__init__(self, name, default, size, names)
 
 
 #######################################################################
 ##  ISIS TLVs                                                        ##
 #######################################################################
-
-_isis_tlv_classes= { 
-           1: "ISIS_AreaTlv",
-           2: "ISIS_IsReachabilityTlv",
-           6: "ISIS_IsNeighbourTlv",
-           8: "ISIS_PaddingTlv",
-           9: "ISIS_LspEntryTlv",
-          10: "ISIS_AuthenticationTlv",
-          12: "ISIS_ChecksumTlv", 
-          14: "ISIS_BufferSizeTlv",
-          22: "ISIS_ExtendedIsReachabilityTlv",
-         128: "ISIS_InternalIpReachabilityTlv",
-         129: "ISIS_ProtocolsSupportedTlv",
-         130: "ISIS_ExternalIpReachabilityTlv",
-         132: "ISIS_IpInterfaceAddressTlv",
-         135: "ISIS_ExtendedIpReachabilityTlv",
-         137: "ISIS_DynamicHostnameTlv",
-         232: "ISIS_Ipv6InterfaceAddressTlv",
-         236: "ISIS_Ipv6ReachabilityTlv",
-         240: "ISIS_P2PAdjacencyStateTlv"
+_isis_tlv_classes = { 
+    1: "ISIS_AreaTlv",
+    2: "ISIS_IsReachabilityTlv",
+    6: "ISIS_IsNeighbourTlv",
+    8: "ISIS_PaddingTlv",
+    9: "ISIS_LspEntryTlv",
+   10: "ISIS_AuthenticationTlv",
+   12: "ISIS_ChecksumTlv",
+   14: "ISIS_BufferSizeTlv",
+   22: "ISIS_ExtendedIsReachabilityTlv",
+  128: "ISIS_InternalIpReachabilityTlv",
+  129: "ISIS_ProtocolsSupportedTlv",
+  130: "ISIS_ExternalIpReachabilityTlv",
+  132: "ISIS_IpInterfaceAddressTlv",
+  135: "ISIS_ExtendedIpReachabilityTlv",
+  137: "ISIS_DynamicHostnameTlv",
+  232: "ISIS_Ipv6InterfaceAddressTlv",
+  236: "ISIS_Ipv6ReachabilityTlv",
+  240: "ISIS_P2PAdjacencyStateTlv"
 }
 
-_isis_tlv_names= { 
-           1: "Area TLV",
-           2: "IS Reachability TLV",
-           6: "IS Neighbour TLV",
-           7: "Instance Identifier TLV",
-           8: "Padding TLV",
-           9: "LSP Entries TLV",
-          10: "Authentication TLV",
-          12: "Optional Checksum TLV",
-          13: "Purge Originator Identification TLV", 
-          14: "LSP Buffer Size TLV",
-          22: "Extended IS-Reachability TLV",
-          23: "IS Neighbour Attribute TLV",
-          24: "IS Alias ID",
-         128: "IP Internal Reachability TLV",
-         129: "Protocols Supported TLV",
-         130: "IP External Reachability TLV",
-         131: "Inter-Domain Routing Protocol Information TLV",
-         132: "IP Interface Address TLV",
-         134: "Traffic Engineering Router ID TLV",
-         135: "Extended IP Reachability TLV",
-         137: "Dynamic Hostname TLV",
-         138: "GMPLS Shared Risk Link Group TLV",
-         139: "IPv6 Shared Risk Link Group TLV",
-         140: "IPv6 Traffic Engineering Router ID TLV",
-         141: "Inter-AS Reachability Information TLV",
-         142: "Group Address TLV",
-         143: "Multi-Topology-Aware Port Capability TLV",
-         144: "Multi-Topology Capability TLV",
-         145: "TRILL Neighbour TLV",
-         147: "MAC-Reachability TLV",
-         148: "BFD-Enabled TLV",
-         211: "Restart TLV",
-         222: "Multi-Topology Intermediate Systems TLV",
-         223: "Multi-Topology IS Neighbour Attributes TLV",
-         229: "Multi-Topology TLV",
-         232: "IPv6 Interface Address TLV",
-         233: "IPv6 Global Interface Address TLV",
-         235: "Multi-Topology IPv4 Reachability TLV",
-         236: "IPv6 Reachability TLV",
-         237: "Multi-Topology IPv6 Reachability TLV",
-         240: "Point-to-Point Three-Way Adjacency TLV",
-         242: "IS-IS Router Capability TLV",
-         251: "Generic Information TLV"
+_isis_tlv_names = {
+    1: "Area TLV",
+    2: "IS Reachability TLV",
+    6: "IS Neighbour TLV",
+    7: "Instance Identifier TLV",
+    8: "Padding TLV",
+    9: "LSP Entries TLV",
+   10: "Authentication TLV",
+   12: "Optional Checksum TLV",
+   13: "Purge Originator Identification TLV", 
+   14: "LSP Buffer Size TLV",
+   22: "Extended IS-Reachability TLV",
+   23: "IS Neighbour Attribute TLV",
+   24: "IS Alias ID",
+  128: "IP Internal Reachability TLV",
+  129: "Protocols Supported TLV",
+  130: "IP External Reachability TLV",
+  131: "Inter-Domain Routing Protocol Information TLV",
+  132: "IP Interface Address TLV",
+  134: "Traffic Engineering Router ID TLV",
+  135: "Extended IP Reachability TLV",
+  137: "Dynamic Hostname TLV",
+  138: "GMPLS Shared Risk Link Group TLV",
+  139: "IPv6 Shared Risk Link Group TLV",
+  140: "IPv6 Traffic Engineering Router ID TLV",
+  141: "Inter-AS Reachability Information TLV",
+  142: "Group Address TLV",
+  143: "Multi-Topology-Aware Port Capability TLV",
+  144: "Multi-Topology Capability TLV",
+  145: "TRILL Neighbour TLV",
+  147: "MAC-Reachability TLV",
+  148: "BFD-Enabled TLV",
+  211: "Restart TLV",
+  222: "Multi-Topology Intermediate Systems TLV",
+  223: "Multi-Topology IS Neighbour Attributes TLV",
+  229: "Multi-Topology TLV",
+  232: "IPv6 Interface Address TLV",
+  233: "IPv6 Global Interface Address TLV",
+  235: "Multi-Topology IPv4 Reachability TLV",
+  236: "IPv6 Reachability TLV",
+  237: "Multi-Topology IPv6 Reachability TLV",
+  240: "Point-to-Point Three-Way Adjacency TLV",
+  242: "IS-IS Router Capability TLV",
+  251: "Generic Information TLV"
 }
 
 
-
 def _ISIS_GuessTlvClass(p, **kargs):
     cls = conf.raw_layer
     if len(p) >= 2:
@@ -300,7 +307,7 @@ class ISIS_AreaEntry(Packet):
     name = "ISIS Area Entry"
     fields_desc = [FieldLenField("arealen", None, length_of="areaid", fmt="B"),
                    ISIS_AreaIdField("areaid", "49", length_from=lambda pkt: pkt.arealen)]
-    
+
     def extract_padding(self, s):
         return "", s
 
@@ -325,7 +332,6 @@ class ISIS_BufferSizeTlv(ISIS_GenericTlv):
     fields_desc = [ByteEnumField("type", 14, _isis_tlv_names),
                    ByteField("len", 2),
                    ShortField("lspbuffersize", 1497)]
-    
 
 
 class ISIS_ChecksumTlv(ISIS_GenericTlv):
@@ -334,7 +340,7 @@ class ISIS_ChecksumTlv(ISIS_GenericTlv):
                    ByteField("len", 2),
                    XShortField("checksum", None)]
 
-    
+
 class ISIS_DynamicHostnameTlv(ISIS_GenericTlv):
     name = "ISIS Dynamic Hostname TLV"
     fields_desc = [ByteEnumField("type", 137, _isis_tlv_names),
@@ -342,7 +348,6 @@ class ISIS_DynamicHostnameTlv(ISIS_GenericTlv):
                    BoundStrLenField("hostname", "", length_from=lambda pkt: pkt.len)]
 
 
-
 class ISIS_GenericSubTlv(Packet):
     name = "ISIS Generic Sub-TLV"
     fields_desc = [ByteField("type", 0),
@@ -352,22 +357,26 @@ class ISIS_GenericSubTlv(Packet):
     def guess_payload_class(self, p):
         return conf.padding_layer
 
+
 def _isis_guess_subtlv_cls(p, **kargs):
     return ISIS_GenericSubTlv(p, **kargs)
 
 
 class ISIS_ExtendedIpPrefix(Packet):
     name = "ISIS Extended IP Prefix"
-    fields_desc = [IntField("metric", 1),
-                   BitField("updown", 0, 1),
-                   BitField("subtlvindicator", 0, 1),
-                   BitFieldLenField("pfxlen", None, 6, length_of="pfx"),
-                   IPPrefixField("pfx", None, wordbytes=1, length_from= lambda x: x.pfxlen),
-                   ConditionalField(FieldLenField("subtlvslen", None, length_of=lambda x: x.subtlvs, fmt= "B"), lambda pkt: pkt.subtlvindicator == 1), 
-                   ConditionalField(PacketListField("subtlvs", [], _isis_guess_subtlv_cls, length_from=lambda x: x.subtlvslen), lambda pkt: pkt.subtlvindicator == 1)]
-    
+    fields_desc = [
+        IntField("metric", 1),
+        BitField("updown", 0, 1),
+        BitField("subtlvindicator", 0, 1),
+        BitFieldLenField("pfxlen", None, 6, length_of="pfx"),
+        IPPrefixField("pfx", None, wordbytes=1, length_from=lambda x: x.pfxlen),
+        ConditionalField(FieldLenField("subtlvslen", None, length_of=lambda x: x.subtlvs, fmt= "B"), lambda pkt: pkt.subtlvindicator == 1), 
+        ConditionalField(PacketListField("subtlvs", [], _isis_guess_subtlv_cls, length_from=lambda x: x.subtlvslen), lambda pkt: pkt.subtlvindicator == 1)
+    ]
+
     def extract_padding(self, s):
         return "", s
+
  
 class ISIS_ExtendedIpReachabilityTlv(ISIS_GenericTlv):
     name = "ISIS Extended IP Reachability TLV"
@@ -379,12 +388,13 @@ class ISIS_ExtendedIpReachabilityTlv(ISIS_GenericTlv):
 class ISIS_ExtendedIsNeighbourEntry(Packet):
     name = "ISIS Extended IS Neighbour Entry"
     fields_desc = [ISIS_NodeIdField("neighbourid", "0102.0304.0506.07"),
-                   X3BytesField("metric", 1),
+                   ThreeBytesField("metric", 1),
                    FieldLenField("subtlvslen", None, length_of="subtlvs", fmt= "B"),
                    ConditionalField(PacketListField("subtlvs", [], _isis_guess_subtlv_cls, length_from=lambda x: x.subtlvslen), lambda pkt: pkt.subtlvslen > 0)]
-    
+
     def extract_padding(self, s):
         return "", s
+
     
 class ISIS_ExtendedIsReachabilityTlv(ISIS_GenericTlv):
     name = "ISIS Extended IS Reachability TLV"
@@ -398,43 +408,48 @@ class ISIS_IpInterfaceAddressTlv(ISIS_GenericTlv):
     fields_desc = [ByteEnumField("type", 132, _isis_tlv_names),
                    FieldLenField("len", None, length_of= "addresses", fmt="B"),
                    FieldListField("addresses", [], IPField("", "0.0.0.0"), count_from= lambda pkt: pkt.len / 4)]
-    
+
 
 class ISIS_Ipv6InterfaceAddressTlv(ISIS_GenericTlv):
     name = "ISIS IPv6 Interface Address TLV"
-    fields_desc = [ByteEnumField("type", 232, _isis_tlv_names),
-                   FieldLenField("len", None, length_of= "addresses", fmt="B"),
-                   IP6ListField("addresses", [], count_from= lambda pkt: pkt.len / 16)]
-
+    fields_desc = [
+        ByteEnumField("type", 232, _isis_tlv_names),
+        FieldLenField("len", None, length_of="addresses", fmt="B"),
+        IP6ListField("addresses", [], count_from=lambda pkt: pkt.len / 16)
+    ]
 
 
 class ISIS_Ipv6Prefix(Packet):
     name = "ISIS IPv6 Prefix"
-    fields_desc = [IntField("metric", 1),
-               BitField("updown", 0, 1),
-               BitField("external", 0, 1),
-               BitField("subtlvindicator", 0, 1),
-               BitField("reserved", 0, 5),
-               FieldLenField("pfxlen", None, length_of="pfx", fmt="B"),
-               IP6PrefixField("pfx", None, wordbytes=1, length_from= lambda x: x.pfxlen),
-               ConditionalField(FieldLenField("subtlvslen", None, length_of=lambda x: x.subtlvs, fmt= "B"), lambda pkt: pkt.subtlvindicator == 1), 
-               ConditionalField(PacketListField("subtlvs", [], _isis_guess_subtlv_cls, length_from=lambda x: x.subtlvslen), lambda pkt: pkt.subtlvindicator == 1)]
-    
+    fields_desc = [
+        IntField("metric", 1),
+        BitField("updown", 0, 1),
+        BitField("external", 0, 1),
+        BitField("subtlvindicator", 0, 1),
+        BitField("reserved", 0, 5),
+        FieldLenField("pfxlen", None, length_of="pfx", fmt="B"),
+        IP6PrefixField("pfx", None, wordbytes=1, length_from=lambda x: x.pfxlen),
+        ConditionalField(FieldLenField("subtlvslen", None, length_of=lambda x: x.subtlvs, fmt= "B"), lambda pkt: pkt.subtlvindicator == 1), 
+        ConditionalField(PacketListField("subtlvs", [], _isis_guess_subtlv_cls, length_from=lambda x: x.subtlvslen), lambda pkt: pkt.subtlvindicator == 1)
+    ]
+
     def extract_padding(self, s):
         return "", s
 
+
 class ISIS_Ipv6ReachabilityTlv(ISIS_GenericTlv):
     name= "ISIS IPv6 Reachability TLV"
     fields_desc = [ByteEnumField("type", 236, _isis_tlv_names),
                    FieldLenField("len", None, length_of= "pfxs", fmt="B"),
                    PacketListField("pfxs", [], ISIS_Ipv6Prefix, length_from= lambda pkt: pkt.len)]
 
+
 class ISIS_IsNeighbourTlv(ISIS_GenericTlv):
     name = "ISIS IS Neighbour TLV"
     fields_desc = [ByteEnumField("type", 6, _isis_tlv_names),
                    FieldLenField("len", None, length_of= "neighbours", fmt="B"),
                    FieldListField("neighbours", [], MACField("", "00.00.00.00.00.00"), count_from= lambda pkt: pkt.len / 6)]
-    
+
 
 class ISIS_LspEntry(Packet):
     name = "ISIS LSP Entry"
@@ -442,31 +457,34 @@ class ISIS_LspEntry(Packet):
                    ISIS_LspIdField("lspid", "0102.0304.0506.07-08"),
                    XIntField("seqnum", 0x00000001),
                    XShortField("checksum", None)]
-    
+
     def extract_padding(self, s):
         return "", s
 
 
 class ISIS_LspEntryTlv(ISIS_GenericTlv):
     name = "ISIS LSP Entry TLV"
-    fields_desc = [ByteEnumField("type", 9, _isis_tlv_names),
-               FieldLenField("len", None, length_of= "entries", fmt="B"),
-               PacketListField("entries", [], ISIS_LspEntry, count_from= lambda pkt: pkt.len / 16)]
+    fields_desc = [
+        ByteEnumField("type", 9, _isis_tlv_names),
+        FieldLenField("len", None, length_of="entries", fmt="B"),
+        PacketListField("entries", [], ISIS_LspEntry, count_from=lambda pkt: pkt.len / 16)
+    ]
 
 
 class _AdjacencyStateTlvLenField(Field):
     def i2m(self, pkt, x):
         if pkt.neighbourextlocalcircuitid is not None:
             return 15
-        
+
         if pkt.neighboursystemid is not None:
             return 11
-        
+
         if pkt.extlocalcircuitid is not None:
             return 5
 
         return 1
 
+
 class ISIS_P2PAdjacencyStateTlv(ISIS_GenericTlv):
     name = "ISIS P2P Adjacency State TLV"
     fields_desc = [ByteEnumField("type", 240, _isis_tlv_names),
@@ -476,19 +494,24 @@ class ISIS_P2PAdjacencyStateTlv(ISIS_GenericTlv):
                ConditionalField(ISIS_SystemIdField("neighboursystemid", None), lambda pkt: pkt.len >= 11),
                ConditionalField(IntField("neighbourextlocalcircuitid", None), lambda pkt: pkt.len == 15)]
 
+
 # TODO dynamically allocate sufficient size
 class ISIS_PaddingTlv(ISIS_GenericTlv):
     name = "ISIS Padding TLV"
-    fields_desc = [ByteEnumField("type", 8, _isis_tlv_names),
-               FieldLenField("len", None, length_of= "padding", fmt="B"),
-               BoundStrLenField("padding", "", length_from=lambda pkt: pkt.len)]
-    
+    fields_desc = [
+        ByteEnumField("type", 8, _isis_tlv_names),
+        FieldLenField("len", None, length_of="padding", fmt="B"),
+        BoundStrLenField("padding", "", length_from=lambda pkt: pkt.len)
+    ]
+
 
 class ISIS_ProtocolsSupportedTlv(ISIS_GenericTlv):
     name = "ISIS Protocols Supported TLV"
-    fields_desc = [ByteEnumField("type", 129, _isis_tlv_names),
-                   FieldLenField("len", None, count_of= "nlpids", fmt="B"),
-                   FieldListField("nlpids", [], ByteEnumField("", "IPv4", network_layer_protocol_ids), count_from= lambda pkt: pkt.len)]
+    fields_desc = [
+        ByteEnumField("type", 129, _isis_tlv_names),
+        FieldLenField("len", None, count_of="nlpids", fmt="B"),
+        FieldListField("nlpids", [], ByteEnumField("", "IPv4", network_layer_protocol_ids), count_from=lambda pkt: pkt.len)
+    ]
 
 
 #######################################################################
@@ -503,21 +526,27 @@ class ISIS_IpReachabilityEntry(Packet):
                    ByteField("errmetric", 0x80),
                    IPField("ipaddress", "0.0.0.0"),
                    IPField("subnetmask", "255.255.255.255")]
-    
+
     def extract_padding(self, s):
         return "", s
 
+
 class ISIS_InternalIpReachabilityTlv(ISIS_GenericTlv):
     name = "ISIS Internal IP Reachability TLV"
-    fields_desc = [ByteEnumField("type", 128, _isis_tlv_names),
-                   FieldLenField("len", None, length_of= "entries", fmt="B"),
-                   PacketListField("entries", [], ISIS_IpReachabilityEntry, count_from= lambda x: x.len / 12)]
+    fields_desc = [
+        ByteEnumField("type", 128, _isis_tlv_names),
+        FieldLenField("len", None, length_of="entries", fmt="B"),
+        PacketListField("entries", [], ISIS_IpReachabilityEntry, count_from=lambda x: x.len / 12)
+    ]
+
 
 class ISIS_ExternalIpReachabilityTLV(ISIS_GenericTlv):
     name = "ISIS External IP Reachability TLV"
-    fields_desc = [ByteEnumField("type", 130, _isis_tlv_names),
-                   FieldLenField("len", None, length_of= "entries", fmt="B"),
-                   PacketListField("entries", [], ISIS_IpReachabilityEntry, count_from= lambda x: x.len / 12)]
+    fields_desc = [
+        ByteEnumField("type", 130, _isis_tlv_names),
+        FieldLenField("len", None, length_of="entries", fmt="B"),
+        PacketListField("entries", [], ISIS_IpReachabilityEntry, count_from=lambda x: x.len / 12)
+    ]
 
 
 class ISIS_IsReachabilityEntry(Packet):
@@ -531,32 +560,35 @@ class ISIS_IsReachabilityEntry(Packet):
     def extract_padding(self, s):
         return "", s
 
+
 class ISIS_IsReachabilityTlv(ISIS_GenericTlv):
     name = "ISIS IS Reachability TLV"
-    fields_desc = [ByteEnumField("type", 2, _isis_tlv_names),
-                   FieldLenField("len", None, fmt="B", length_of= "neighbours", adjust= lambda pkt,x: x+1),
-                   ByteField("virtual", 0),
-                   PacketListField("neighbours", [], ISIS_IsReachabilityEntry, count_from= lambda x: (x.len - 1) / 11)]
-
+    fields_desc = [
+        ByteEnumField("type", 2, _isis_tlv_names),
+        FieldLenField("len", None, fmt="B", length_of="neighbours", adjust=lambda pkt,x: x+1),
+        ByteField("virtual", 0),
+        PacketListField("neighbours", [], ISIS_IsReachabilityEntry, count_from=lambda x: (x.len - 1) / 11)
+    ]
 
 #######################################################################
 ##  ISIS PDU Packets                                                 ##
 #######################################################################
 _isis_pdu_names = {
-        15: "L1 LAN Hello",
-        16: "L2 LAN Hello",
-        17: "P2P Hello",
-        18: "L1 LSP",
-        20: "L2 LSP",
-        24: "L1 CSNP",
-        25: "L2 CSNP",
-        26: "L1 PSNP",
-        27: "L2 PSNP"
+    15: "L1 LAN Hello",
+    16: "L2 LAN Hello",
+    17: "P2P Hello",
+    18: "L1 LSP",
+    20: "L2 LSP",
+    24: "L1 CSNP",
+    25: "L2 CSNP",
+    26: "L1 PSNP",
+    27: "L2 PSNP"
 }
 
+
 class ISIS_CommonHdr(Packet):
-    name= "ISIS Common Header"
-    fields_desc= [
+    name = "ISIS Common Header"
+    fields_desc = [
         ByteEnumField("nlpid", 0x83, network_layer_protocol_ids),
         ByteField("hdrlen", None),
         ByteField("version", 1),
@@ -569,44 +601,45 @@ class ISIS_CommonHdr(Packet):
 
     def post_build(self, pkt, pay):
         # calculating checksum if requested
-        pdu= pkt + pay
-        checksumInfo= self[1].checksum_info(self.hdrlen)
-        
+        pdu = pkt + pay
+        checksumInfo = self[1].checksum_info(self.hdrlen)
+
         if checksumInfo is not None:
             (cbegin, cpos) = checksumInfo
-            checkbytes= fletcher16_checkbytes(pdu[cbegin:], (cpos - cbegin))
+            checkbytes = fletcher16_checkbytes(pdu[cbegin:], (cpos - cbegin))
             pdu = pdu[:cpos] + checkbytes + pdu[cpos+2:]
-        
+
         return pdu
 
 
 class _ISIS_PduBase(Packet):
     def checksum_info(self, hdrlen):
-        checksumPosition= hdrlen
+        checksumPosition = hdrlen
         for tlv in self.tlvs:
             if isinstance(tlv, ISIS_ChecksumTlv):
-                checksumPosition+= 2
+                checksumPosition += 2
                 return (0, checksumPosition)
             else:
-                checksumPosition+= len(tlv)
-            
+                checksumPosition += len(tlv)
+
         return None
-    
+
     def guess_payload_class(self, p):
         return conf.padding_layer
 
 
 class _ISIS_PduLengthField(FieldLenField):
     def __init__(self):
-        FieldLenField.__init__(self, "pdulength", None, length_of= "tlvs", adjust= lambda pkt,x: x + pkt.underlayer.hdrlen)
-        
+        FieldLenField.__init__(self, "pdulength", None, length_of="tlvs", adjust=lambda pkt,x: x + pkt.underlayer.hdrlen)
+
 
 class _ISIS_TlvListField(PacketListField):
     def __init__(self):
         PacketListField.__init__(self, "tlvs", [], _ISIS_GuessTlvClass, count_from= None, length_from= lambda pkt: pkt.pdulength - pkt.underlayer.hdrlen)
 
+
 class _ISIS_LAN_HelloBase(_ISIS_PduBase):
-    fields_desc= [
+    fields_desc = [
         ISIS_CircuitTypeField(),
         ISIS_SystemIdField("sourceid", "0102.0304.0506"),
         ShortField("holdingtime", 30),
@@ -616,17 +649,19 @@ class _ISIS_LAN_HelloBase(_ISIS_PduBase):
         _ISIS_TlvListField()
     ]
 
+
 class ISIS_L1_LAN_Hello(_ISIS_LAN_HelloBase):
-    name= "ISIS L1 LAN Hello PDU"
+    name = "ISIS L1 LAN Hello PDU"
+
 
 class ISIS_L2_LAN_Hello(_ISIS_LAN_HelloBase):
-    name= "ISIS L2 LAN Hello PDU"
+    name = "ISIS L2 LAN Hello PDU"
 
 
 class ISIS_P2P_Hello(_ISIS_PduBase):
-    name= "ISIS Point-to-Point Hello PDU"
-    
-    fields_desc= [
+    name = "ISIS Point-to-Point Hello PDU"
+
+    fields_desc = [
         ISIS_CircuitTypeField(),
         ISIS_SystemIdField("sourceid", "0102.0304.0506"),
         ShortField("holdingtime", 30),
@@ -637,7 +672,7 @@ class ISIS_P2P_Hello(_ISIS_PduBase):
 
 
 class _ISIS_LSP_Base(_ISIS_PduBase):
-    fields_desc= [
+    fields_desc = [
         _ISIS_PduLengthField(),
         ShortField("lifetime", 1199),
         ISIS_LspIdField("lspid", "0102.0304.0506.00-00"),
@@ -646,32 +681,35 @@ class _ISIS_LSP_Base(_ISIS_PduBase):
         FlagsField("typeblock", 0x03, 8, ["L1", "L2", "OL", "ADef", "ADel", "AExp", "AErr", "P"]),
         _ISIS_TlvListField()
     ]
-    
+
     def checksum_info(self, hdrlen):
         if self.checksum is not None:
             return None
-        
+
         return (12, 24)
 
+
 def _lsp_answers(lsp, other, clsname):
     # TODO
     return 0
 
+
 class ISIS_L1_LSP(_ISIS_LSP_Base):
-    name= "ISIS L1 Link State PDU"
-    
+    name = "ISIS L1 Link State PDU"
+
     def answers(self, other):
         return _lsp_answers(self, other, "ISIS_L1_PSNP")
 
+
 class ISIS_L2_LSP(_ISIS_LSP_Base):
-    name= "ISIS L2 Link State PDU"
-    
+    name = "ISIS L2 Link State PDU"
+
     def answers(self, other):
         return _lsp_answers(self, other, "ISIS_L2_PSNP")
 
 
 class _ISIS_CSNP_Base(_ISIS_PduBase):
-    fields_desc= [
+    fields_desc = [
         _ISIS_PduLengthField(),
         ISIS_NodeIdField("sourceid", "0102.0304.0506.00"),
         ISIS_LspIdField("startlspid", "0000.0000.0000.00-00"),
@@ -679,48 +717,54 @@ class _ISIS_CSNP_Base(_ISIS_PduBase):
         _ISIS_TlvListField()
     ]
 
+
 def _snp_answers(snp, other, clsname):
     # TODO
     return 0
 
+
 class ISIS_L1_CSNP(_ISIS_CSNP_Base):
-    name= "ISIS L1 Complete Sequence Number Packet"
-    
+    name = "ISIS L1 Complete Sequence Number Packet"
+
     def answers(self, other):
         return _snp_answers(self, other, "ISIS_L1_LSP")
 
+
 class ISIS_L2_CSNP(_ISIS_CSNP_Base):
-    name= "ISIS L2 Complete Sequence Number Packet"
+    name = "ISIS L2 Complete Sequence Number Packet"
 
     def answers(self, other):
         return _snp_answers(self, other, "ISIS_L2_LSP")
 
+
 class _ISIS_PSNP_Base(_ISIS_PduBase):
-    fields_desc= [
+    fields_desc = [
         _ISIS_PduLengthField(),
         ISIS_NodeIdField("sourceid", "0102.0304.0506.00"),
         _ISIS_TlvListField()
     ]
 
+
 class ISIS_L1_PSNP(_ISIS_PSNP_Base):
-    name= "ISIS L1 Partial Sequence Number Packet"
-    
+    name = "ISIS L1 Partial Sequence Number Packet"
+
     def answers(self, other):
         return _snp_answers(self, other, "ISIS_L1_LSP")
 
+
 class ISIS_L2_PSNP(_ISIS_PSNP_Base):
-    name= "ISIS L2 Partial Sequence Number Packet"
-    
+    name = "ISIS L2 Partial Sequence Number Packet"
+
     def answers(self, other):
         return _snp_answers(self, other, "ISIS_L2_LSP")
 
 register_cln_protocol(0x83, ISIS_CommonHdr)
-bind_layers(ISIS_CommonHdr, ISIS_L1_LAN_Hello, hdrlen= 27, pdutype= 15)
-bind_layers(ISIS_CommonHdr, ISIS_L2_LAN_Hello, hdrlen= 27, pdutype= 16)
-bind_layers(ISIS_CommonHdr, ISIS_P2P_Hello, hdrlen= 20, pdutype= 17)
-bind_layers(ISIS_CommonHdr, ISIS_L1_LSP, hdrlen= 27, pdutype= 18)
-bind_layers(ISIS_CommonHdr, ISIS_L2_LSP, hdrlen= 27, pdutype= 20)
-bind_layers(ISIS_CommonHdr, ISIS_L1_CSNP, hdrlen= 33, pdutype= 24)
-bind_layers(ISIS_CommonHdr, ISIS_L2_CSNP, hdrlen= 33, pdutype= 25)
-bind_layers(ISIS_CommonHdr, ISIS_L1_PSNP, hdrlen= 17, pdutype= 26)
-bind_layers(ISIS_CommonHdr, ISIS_L2_PSNP, hdrlen= 17, pdutype= 27)
\ No newline at end of file
+bind_layers(ISIS_CommonHdr, ISIS_L1_LAN_Hello, hdrlen=27, pdutype=15)
+bind_layers(ISIS_CommonHdr, ISIS_L2_LAN_Hello, hdrlen=27, pdutype=16)
+bind_layers(ISIS_CommonHdr, ISIS_P2P_Hello, hdrlen=20, pdutype=17)
+bind_layers(ISIS_CommonHdr, ISIS_L1_LSP, hdrlen=27, pdutype=18)
+bind_layers(ISIS_CommonHdr, ISIS_L2_LSP, hdrlen=27, pdutype=20)
+bind_layers(ISIS_CommonHdr, ISIS_L1_CSNP, hdrlen=33, pdutype=24)
+bind_layers(ISIS_CommonHdr, ISIS_L2_CSNP, hdrlen=33, pdutype=25)
+bind_layers(ISIS_CommonHdr, ISIS_L1_PSNP, hdrlen=17, pdutype=26)
+bind_layers(ISIS_CommonHdr, ISIS_L2_PSNP, hdrlen=17, pdutype=27)
\ No newline at end of file
diff --git a/scapy/contrib/isis.uts b/scapy/contrib/isis.uts
new file mode 100644
index 0000000000000000000000000000000000000000..78cc12e7c02134ef8412a5997e597f1d2a01eebe
--- /dev/null
+++ b/scapy/contrib/isis.uts
@@ -0,0 +1,57 @@
+% IS-IS Tests
+* Tests for the IS-IS layer
+
++ Basic Layer Tests
+
+= Layer Binding
+p = Dot3()/LLC()/ISIS_CommonHdr()/ISIS_P2P_Hello()
+assert(p[LLC].dsap == 0xfe)
+assert(p[LLC].ssap == 0xfe)
+assert(p[LLC].ctrl == 0x03)
+assert(p[ISIS_CommonHdr].nlpid == 0x83)
+assert(p[ISIS_CommonHdr].pdutype == 17)
+assert(p[ISIS_CommonHdr].hdrlen == 20)
+
++ Package Tests
+= LSP
+p = Dot3(dst="09:00:2b:00:00:05",src="00:00:00:aa:00:8c")/LLC()/ISIS_CommonHdr()/ISIS_L2_LSP(
+         lifetime=863, lspid="1720.1600.8016.00-00", seqnum=0x1f0, typeblock="L1+L2", 
+         tlvs=[
+             ISIS_AreaTlv(
+                 areas=[ISIS_AreaEntry(areaid="49.1000")]
+             ),
+             ISIS_ProtocolsSupportedTlv(
+                 nlpids=["IPv4", "IPv6"]
+             ),
+             ISIS_DynamicHostnameTlv(
+                 hostname="BR-HH"
+             ),
+             ISIS_IpInterfaceAddressTlv(
+                 addresses=["172.16.8.16"]
+             ),
+             ISIS_GenericTlv(
+                 type=134,
+                 val="\xac\x10\x08\x10"
+             ),
+             ISIS_ExtendedIpReachabilityTlv(
+                 pfxs=[
+                     ISIS_ExtendedIpPrefix(metric=0, pfx="172.16.8.16/32"),
+                     ISIS_ExtendedIpPrefix(metric=10, pfx="10.1.0.109/30"),
+                     ISIS_ExtendedIpPrefix(metric=10, pfx="10.1.0.181/30")
+                 ]
+             ),
+             ISIS_Ipv6ReachabilityTlv(
+                 pfxs=[
+                     ISIS_Ipv6Prefix(metric=0, pfx="fe10:1::10/128"),
+                     ISIS_Ipv6Prefix(metric=10, pfx="fd1f:1::/64"),
+                     ISIS_Ipv6Prefix(metric=10, pfx="fd1f:1:12::/64")
+                 ]
+             ),
+             ISIS_ExtendedIsReachabilityTlv(
+                 neighbours=[ISIS_ExtendedIsNeighbourEntry(neighbourid="1720.1600.8004.00", metric=10)]
+             )
+         ]
+    )
+p = p.__class__(str(p))
+assert(p[ISIS_L2_LSP].pdulength == 150)
+assert(p[ISIS_L2_LSP].checksum == 0x8701)
\ No newline at end of file
diff --git a/scapy/layers/clns.py b/scapy/layers/clns.py
index 37a2f51748d2f6f608416fb7b66c1d4a1c008603..0422f7890117e3108951ec46d8e38200592f2304 100644
--- a/scapy/layers/clns.py
+++ b/scapy/layers/clns.py
@@ -2,7 +2,7 @@
     CLNS Extension
     ~~~~~~~~~~~~~~~~~~~~~
 
-    :copyright: 2014 BENOCS GmbH, Berlin (Germany)
+    :copyright: 2014, 2015 BENOCS GmbH, Berlin (Germany)
     :author:    Marcel Patzlaff, mpatzlaff@benocs.com
     :license:   GPLv2
 
@@ -18,69 +18,67 @@
 
     :description:
 
-        This module provides a layer and registration function for
-        OSI Connectionless-mode Network Services (such as IS-IS).
-                
-    :TODO:
-
-        - rework this if a better way is found/implemented to bind
-          protocols such as IS-IS (or if IS-IS remains the sole CLN
-          protocol)
-
+        This module provides a registration function and a generic PDU
+        for OSI Connectionless-mode Network Services (such as IS-IS).
 """
 import struct
 
 from scapy.config import conf
 from scapy.fields import ByteEnumField, PacketField
 from scapy.layers.l2 import LLC
-from scapy.packet import Packet, bind_layers
-
-
-network_layer_protocol_ids= {
-    0x00 : "Null",
-    0x08 : "Q.933",
-    0x80 : "IEEE SNAP",
-    0x81 : "ISO 8438 CLNP",
-    0x82 : "ISO 9542 ES-IS",
-    0x83 : "ISO 10589 IS-IS",
-    0x8E : "IPv6",
-    0xB0 : "FRF.9",
-    0xB1 : "FRF.12",
-    0xC0 : "TRILL",
-    0xC1 : "IEEE 802.aq",
-    0xCC : "IPv4",
-    0xCF : "PPP"
+from scapy.packet import Packet, bind_top_down, bind_bottom_up
+
+
+network_layer_protocol_ids = {
+    0x00: "Null",
+    0x08: "Q.933",
+    0x80: "IEEE SNAP",
+    0x81: "ISO 8438 CLNP",
+    0x82: "ISO 9542 ES-IS",
+    0x83: "ISO 10589 IS-IS",
+    0x8E: "IPv6",
+    0xB0: "FRF.9",
+    0xB1: "FRF.12",
+    0xC0: "TRILL",
+    0xC1: "IEEE 802.aq",
+    0xCC: "IPv4",
+    0xCF: "PPP"
 }
 
 
-_cln_protocols= {}
+_cln_protocols = {}
+
 
 class _GenericClnsPdu(Packet):
-    name= "Generic CLNS PDU"
-    fields_desc= [
+    name = "Generic CLNS PDU"
+    fields_desc = [
         ByteEnumField("nlpid", 0x00, network_layer_protocol_ids),
         PacketField("rawdata", None, conf.raw_layer)
     ]
-    
-
-class ConnectionlessNetworkService(Packet):
-    name= "Connectionless-mode Network Service"
-    
-    def guess_payload_class(self, p):
-        cls= conf.raw_layer
-         
-        if len(p) >= 1:
-            nlpid = struct.unpack("!B", p[0])[0]
-            cls= _cln_protocols.get(nlpid, _GenericClnsPdu)
-             
-        return cls
+
+
+def _create_cln_pdu(s, **kwargs):
+    pdu_cls = conf.raw_layer
+
+    if len(s) >= 1:
+        nlpid = struct.unpack("!B", s[0])[0]
+        pdu_cls = _cln_protocols.get(nlpid, _GenericClnsPdu)
+
+    return pdu_cls(s, **kwargs)
+
 
 @conf.commands.register
 def register_cln_protocol(nlpid, cln_protocol_class):
     if nlpid is None or cln_protocol_class is None:
         return
-    
-    _cln_protocols[nlpid]= cln_protocol_class
+
+    chk = _cln_protocols.get(nlpid, None)
+    if chk is not None and chk != cln_protocol_class:
+        raise ValueError("different protocol already registered!")
+
+    _cln_protocols[nlpid] = cln_protocol_class
+    bind_top_down(LLC, cln_protocol_class, dsap=0xfe, ssap=0xfe, ctrl=3)
 
 
-bind_layers(LLC, ConnectionlessNetworkService, dsap=0xfe, ssap=0xfe, ctrl=3)
\ No newline at end of file
+bind_top_down(LLC, _GenericClnsPdu, dsap=0xfe, ssap=0xfe, ctrl=3)
+bind_bottom_up(LLC, _create_cln_pdu, dsap=0xfe, ssap=0xfe, ctrl=3)
diff --git a/scapy/layers/inet6.py b/scapy/layers/inet6.py
index 6233e21d80ab043f16e4500e8f1b15e6ffba5b4c..22668f8ee2e393e061a542f2c6ecfc3591786dc2 100644
--- a/scapy/layers/inet6.py
+++ b/scapy/layers/inet6.py
@@ -259,6 +259,7 @@ ipv6nh = { 0:"Hop-by-Hop Option Header",
           58:"ICMPv6",
           59:"No Next Header",
           60:"Destination Option Header",
+         132:"SCTP",
          135:"Mobility Header"} 
 
 ipv6nhcls = {  0: "IPv6ExtHdrHopByHop",
diff --git a/scapy/layers/sctp.py b/scapy/layers/sctp.py
index 299e49c1d3d85926c94b0d7e411097094fb0ab5e..49d441226ca2b0230fd7356a1c09662a540da411 100644
--- a/scapy/layers/sctp.py
+++ b/scapy/layers/sctp.py
@@ -14,6 +14,7 @@ from scapy.packet import *
 from scapy.fields import *
 from scapy.layers.inet import IP
 from scapy.layers.inet6 import IP6Field
+from scapy.layers.inet6 import IPv6
 
 IPPROTO_SCTP=132
 
@@ -432,4 +433,5 @@ class SCTPChunkShutdownComplete(_SCTPChunkGuessPayload, Packet):
                     ]
 
 bind_layers( IP,           SCTP,          proto=IPPROTO_SCTP)
+bind_layers( IPv6,           SCTP,          nh=IPPROTO_SCTP)
 
diff --git a/scapy/utils.py b/scapy/utils.py
index c9bf4ede25e1d25b673eecfa13e9347ff4324246..23ebccd88441af967317f379a0b904416e378492 100644
--- a/scapy/utils.py
+++ b/scapy/utils.py
@@ -618,7 +618,7 @@ class RawPcapReader:
         return self
 
     def __exit__(self, exc_type, exc_value, tracback):
-        pass
+        self.close()
 
 
 class PcapReader(RawPcapReader):
@@ -750,6 +750,7 @@ class RawPcapWriter:
         return self
     def __exit__(self, exc_type, exc_value, tracback):
         self.flush()
+        self.close()
 
 
 class PcapWriter(RawPcapWriter):