aboutsummaryrefslogtreecommitdiffstats
path: root/docs/reference/cmdreference/vhost
diff options
context:
space:
mode:
authorRenato Botelho do Couto <renato@netgate.com>2019-11-07 06:10:34 -0600
committerDamjan Marion <dmarion@me.com>2019-12-17 18:23:43 +0000
commitc025329bb244952938c8575a1d5602a1e54e5fe7 (patch)
treedf78a9fbbf7b8a32588e66303274e33bf8b159f0 /docs/reference/cmdreference/vhost
parent842506f3c9ac8136642d3f9b49bb73f05f63cfdb (diff)
misc: Add CentOS 8 package support
Type: feature Added missing dependencies on RPM spec file and install-dep Ticket: VPP-1800 Signed-off-by: Renato Botelho do Couto <renato@netgate.com> Change-Id: I91d39c94b3f03c213249dff42b264718ef772bdb
Diffstat (limited to 'docs/reference/cmdreference/vhost')
0 files changed, 0 insertions, 0 deletions
mbol */ .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 */
## This file is part of Scapy
## See http://www.secdev.org/projects/scapy for more informations
## Copyright (C) Philippe Biondi <phil@secdev.org>
## This program is published under a GPLv2 license

"""
L2TP (Layer 2 Tunneling Protocol) for VPNs.

[RFC 2661]
"""

import struct

from scapy.packet import *
from scapy.fields import *
from scapy.layers.inet import UDP
from scapy.layers.ppp import PPP

class L2TP(Packet):
    fields_desc = [ ShortEnumField("pkt_type",2,{2:"data"}),
                    ShortField("len", None),
                    ShortField("tunnel_id", 0),
                    ShortField("session_id", 0),
                    ShortField("ns", 0),
                    ShortField("nr", 0),
                    ShortField("offset", 0) ]

    def post_build(self, pkt, pay):
        if self.len is None:
            l = len(pkt)+len(pay)
            pkt = pkt[:2]+struct.pack("!H", l)+pkt[4:]
        return pkt+pay


bind_layers( UDP,           L2TP,          sport=1701, dport=1701)
bind_layers( L2TP,          PPP,           )