blob: 39e99d4045e9de336f14eeb010a67eacaffbf056 [file] [log] [blame]
Matthew Smith39e94282020-02-11 11:25:32 -06001diff --git a/scapy/layers/vrrp.py b/scapy/layers/vrrp.py
2index 1b583653..3d6a5923 100644
3--- a/scapy/layers/vrrp.py
4+++ b/scapy/layers/vrrp.py
5@@ -10,7 +10,7 @@ VRRP (Virtual Router Redundancy Protocol).
6
7 from scapy.packet import Packet, bind_layers
8 from scapy.fields import BitField, ByteField, FieldLenField, FieldListField, \
9- IPField, IntField, XShortField
10+ IPField, IP6Field, IntField, MultipleTypeField, StrField, XShortField
11 from scapy.compat import chb, orb
12 from scapy.layers.inet import IP, in4_chksum, checksum
13 from scapy.layers.inet6 import IPv6, in6_chksum
14@@ -62,9 +62,18 @@ class VRRPv3(Packet):
15 BitField("res", 0, 4),
16 BitField("adv", 100, 12),
17 XShortField("chksum", None),
18- # FIXME: addrlist should also allow IPv6 addresses :/
19- FieldListField("addrlist", [], IPField("", "0.0.0.0"),
20- count_from=lambda pkt: pkt.ipcount)]
21+ MultipleTypeField(
22+ [
23+ (FieldListField("addrlist", [], IPField("", "0.0.0.0"),
24+ count_from=lambda pkt: pkt.ipcount),
25+ lambda p: isinstance(p.underlayer, IP)),
26+ (FieldListField("addrlist", [], IP6Field("", "::"),
27+ count_from=lambda pkt: pkt.ipcount),
28+ lambda p: isinstance(p.underlayer, IPv6)),
29+ ],
30+ StrField("addrlist", "")
31+ )
32+ ]
33
34 def post_build(self, p, pay):
35 if self.chksum is None: