39e9428b90
Type: feature Add a new plugin to support HA using VRRPv3 (RFC 5798). Change-Id: Iaa2c37e6172f8f41e9165f178f44d481f6e247b9 Signed-off-by: Matthew Smith <mgsmith@netgate.com>
36 lines
1.5 KiB
Diff
36 lines
1.5 KiB
Diff
diff --git a/scapy/layers/vrrp.py b/scapy/layers/vrrp.py
|
|
index 1b583653..3d6a5923 100644
|
|
--- a/scapy/layers/vrrp.py
|
|
+++ b/scapy/layers/vrrp.py
|
|
@@ -10,7 +10,7 @@ VRRP (Virtual Router Redundancy Protocol).
|
|
|
|
from scapy.packet import Packet, bind_layers
|
|
from scapy.fields import BitField, ByteField, FieldLenField, FieldListField, \
|
|
- IPField, IntField, XShortField
|
|
+ IPField, IP6Field, IntField, MultipleTypeField, StrField, XShortField
|
|
from scapy.compat import chb, orb
|
|
from scapy.layers.inet import IP, in4_chksum, checksum
|
|
from scapy.layers.inet6 import IPv6, in6_chksum
|
|
@@ -62,9 +62,18 @@ class VRRPv3(Packet):
|
|
BitField("res", 0, 4),
|
|
BitField("adv", 100, 12),
|
|
XShortField("chksum", None),
|
|
- # FIXME: addrlist should also allow IPv6 addresses :/
|
|
- FieldListField("addrlist", [], IPField("", "0.0.0.0"),
|
|
- count_from=lambda pkt: pkt.ipcount)]
|
|
+ MultipleTypeField(
|
|
+ [
|
|
+ (FieldListField("addrlist", [], IPField("", "0.0.0.0"),
|
|
+ count_from=lambda pkt: pkt.ipcount),
|
|
+ lambda p: isinstance(p.underlayer, IP)),
|
|
+ (FieldListField("addrlist", [], IP6Field("", "::"),
|
|
+ count_from=lambda pkt: pkt.ipcount),
|
|
+ lambda p: isinstance(p.underlayer, IPv6)),
|
|
+ ],
|
|
+ StrField("addrlist", "")
|
|
+ )
|
|
+ ]
|
|
|
|
def post_build(self, p, pay):
|
|
if self.chksum is None:
|