We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Add support for IPv6 addresses in VRRPv3 layer
#### Brief description

The VRRPv3 layer has a field addrlist which supports IPv4 addresses only.

This prevents use of the layer for generating IPv6 VRRPv3 advertisement packets.

#### Environment

-   Scapy version: `v2.4.3-242-gdcfb63d0`
-   Python version: `3.7.6`
-   Operating System: `macOS Mojave 10.14.6`

Problem was originally observed on CentOS 7.7 with scapy v2.4.3 using python 3.6. Tested using current github master branch (as above) on macOS to confirm.

#### How to reproduce

```
from scapy.layers.l2 import Ether
from scapy.layers.inet6 import IPv6
from scapy.layers.vrrp import VRRPv3

pkt = (Ether(src="00:00:5e:00:02:64",dst="33:33:00:00:00:12")/IPv6(src="2001:db8::1",dst="ff02::12")/VRRPv3(vrid=100,ipcount=1,addrlist=[ "2001:db8::100" ]))
```

#### Actual result

```
Traceback (most recent call last):
  File "/Users/mgsmith/src/scapy/scapy/fields.py", line 535, in h2i
    inet_aton(x)
OSError: illegal IP address string passed to inet_aton

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/Users/mgsmith/src/scapy/scapy/base_classes.py", line 266, in __call__
    i.__init__(*args, **kargs)
  File "/Users/mgsmith/src/scapy/scapy/packet.py", line 157, in __init__
    self.fields[fname] = self.get_field(fname).any2i(self, value)
  File "/Users/mgsmith/src/scapy/scapy/fields.py", line 1412, in any2i
    return [self.field.any2i(pkt, e) for e in x]
  File "/Users/mgsmith/src/scapy/scapy/fields.py", line 1412, in <listcomp>
    return [self.field.any2i(pkt, e) for e in x]
  File "/Users/mgsmith/src/scapy/scapy/fields.py", line 562, in any2i
    return self.h2i(pkt, x)
  File "/Users/mgsmith/src/scapy/scapy/fields.py", line 537, in h2i
    x = Net(x)
  File "/Users/mgsmith/src/scapy/scapy/base_classes.py", line 108, in __init__
    self.parsed, self.netmask = self._parse_net(net)
  File "/Users/mgsmith/src/scapy/scapy/base_classes.py", line 101, in _parse_net
    tmp[0] = socket.gethostbyname(tmp[0])
socket.gaierror: [Errno 8] nodename nor servname provided, or not known
```

#### Expected result

No error, valid packet created.

#### Related resources

RFC 5798
I have a patch which adds this support which I will submit as a pull request. See https://github.com/mgsmith1000/scapy/commit/020a6695d48d16b5521bf78a4a1ef5efba14fd21.


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `scapy/layers/vrrp.py`
Content:
```
1 # This file is part of Scapy
2 # See http://www.secdev.org/projects/scapy for more information
3 # Copyright (C) Philippe Biondi <phil@secdev.org>
4 # Copyright (C) 6WIND <olivier.matz@6wind.com>
5 # This program is published under a GPLv2 license
6 
7 """
8 VRRP (Virtual Router Redundancy Protocol).
9 """
10 
11 from scapy.packet import Packet, bind_layers
12 from scapy.fields import BitField, ByteField, FieldLenField, FieldListField, \
13     IPField, IntField, XShortField
14 from scapy.compat import chb, orb
15 from scapy.layers.inet import IP, in4_chksum, checksum
16 from scapy.layers.inet6 import IPv6, in6_chksum
17 from scapy.error import warning
18 
19 IPPROTO_VRRP = 112
20 
21 # RFC 3768 - Virtual Router Redundancy Protocol (VRRP)
22 
23 
24 class VRRP(Packet):
25     fields_desc = [
26         BitField("version", 2, 4),
27         BitField("type", 1, 4),
28         ByteField("vrid", 1),
29         ByteField("priority", 100),
30         FieldLenField("ipcount", None, count_of="addrlist", fmt="B"),
31         ByteField("authtype", 0),
32         ByteField("adv", 1),
33         XShortField("chksum", None),
34         FieldListField("addrlist", [], IPField("", "0.0.0.0"),
35                        count_from=lambda pkt: pkt.ipcount),
36         IntField("auth1", 0),
37         IntField("auth2", 0)]
38 
39     def post_build(self, p, pay):
40         if self.chksum is None:
41             ck = checksum(p)
42             p = p[:6] + chb(ck >> 8) + chb(ck & 0xff) + p[8:]
43         return p
44 
45     @classmethod
46     def dispatch_hook(cls, _pkt=None, *args, **kargs):
47         if _pkt and len(_pkt) >= 9:
48             ver_n_type = orb(_pkt[0])
49             if ver_n_type >= 48 and ver_n_type <= 57:  # Version == 3
50                 return VRRPv3
51         return VRRP
52 
53 
54 # RFC 5798 -  Virtual Router Redundancy Protocol (VRRP) Version 3
55 class VRRPv3(Packet):
56     fields_desc = [
57         BitField("version", 3, 4),
58         BitField("type", 1, 4),
59         ByteField("vrid", 1),
60         ByteField("priority", 100),
61         FieldLenField("ipcount", None, count_of="addrlist", fmt="B"),
62         BitField("res", 0, 4),
63         BitField("adv", 100, 12),
64         XShortField("chksum", None),
65         # FIXME: addrlist should also allow IPv6 addresses :/
66         FieldListField("addrlist", [], IPField("", "0.0.0.0"),
67                        count_from=lambda pkt: pkt.ipcount)]
68 
69     def post_build(self, p, pay):
70         if self.chksum is None:
71             if isinstance(self.underlayer, IP):
72                 ck = in4_chksum(112, self.underlayer, p)
73             elif isinstance(self.underlayer, IPv6):
74                 ck = in6_chksum(112, self.underlayer, p)
75             else:
76                 warning("No IP(v6) layer to compute checksum on VRRP. Leaving null")  # noqa: E501
77                 ck = 0
78             p = p[:6] + chb(ck >> 8) + chb(ck & 0xff) + p[8:]
79         return p
80 
81     @classmethod
82     def dispatch_hook(cls, _pkt=None, *args, **kargs):
83         if _pkt and len(_pkt) >= 16:
84             ver_n_type = orb(_pkt[0])
85             if ver_n_type < 48 or ver_n_type > 57:  # Version != 3
86                 return VRRP
87         return VRRPv3
88 
89 
90 # IPv6 is supported only on VRRPv3
91 # Warning: those layers need to be un-binded in the CARP contrib module.
92 # If you add/remove any, remember to also edit the one in CARP.py
93 bind_layers(IP, VRRP, proto=IPPROTO_VRRP)
94 bind_layers(IP, VRRPv3, proto=IPPROTO_VRRP)
95 bind_layers(IPv6, VRRPv3, nh=IPPROTO_VRRP)
96
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/scapy/layers/vrrp.py b/scapy/layers/vrrp.py
--- a/scapy/layers/vrrp.py
+++ b/scapy/layers/vrrp.py
@@ -10,7 +10,7 @@
 
 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 @@
         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:

{"golden_diff": "diff --git a/scapy/layers/vrrp.py b/scapy/layers/vrrp.py\n--- a/scapy/layers/vrrp.py\n+++ b/scapy/layers/vrrp.py\n@@ -10,7 +10,7 @@\n \n from scapy.packet import Packet, bind_layers\n from scapy.fields import BitField, ByteField, FieldLenField, FieldListField, \\\n-    IPField, IntField, XShortField\n+    IPField, IP6Field, IntField, MultipleTypeField, StrField, XShortField\n from scapy.compat import chb, orb\n from scapy.layers.inet import IP, in4_chksum, checksum\n from scapy.layers.inet6 import IPv6, in6_chksum\n@@ -62,9 +62,18 @@\n         BitField(\"res\", 0, 4),\n         BitField(\"adv\", 100, 12),\n         XShortField(\"chksum\", None),\n-        # FIXME: addrlist should also allow IPv6 addresses :/\n-        FieldListField(\"addrlist\", [], IPField(\"\", \"0.0.0.0\"),\n-                       count_from=lambda pkt: pkt.ipcount)]\n+        MultipleTypeField(\n+            [\n+                (FieldListField(\"addrlist\", [], IPField(\"\", \"0.0.0.0\"),\n+                                count_from=lambda pkt: pkt.ipcount),\n+                 lambda p: isinstance(p.underlayer, IP)),\n+                (FieldListField(\"addrlist\", [], IP6Field(\"\", \"::\"),\n+                                count_from=lambda pkt: pkt.ipcount),\n+                 lambda p: isinstance(p.underlayer, IPv6)),\n+            ],\n+            StrField(\"addrlist\", \"\")\n+        )\n+    ]\n \n     def post_build(self, p, pay):\n         if self.chksum is None:\n", "issue": "Add support for IPv6 addresses in VRRPv3 layer\n#### Brief description\r\n\r\nThe VRRPv3 layer has a field addrlist which supports IPv4 addresses only.\r\n\r\nThis prevents use of the layer for generating IPv6 VRRPv3 advertisement packets.\r\n\r\n#### Environment\r\n\r\n-   Scapy version: `v2.4.3-242-gdcfb63d0`\r\n-   Python version: `3.7.6`\r\n-   Operating System: `macOS Mojave 10.14.6`\r\n\r\nProblem was originally observed on CentOS 7.7 with scapy v2.4.3 using python 3.6. Tested using current github master branch (as above) on macOS to confirm.\r\n\r\n#### How to reproduce\r\n\r\n```\r\nfrom scapy.layers.l2 import Ether\r\nfrom scapy.layers.inet6 import IPv6\r\nfrom scapy.layers.vrrp import VRRPv3\r\n\r\npkt = (Ether(src=\"00:00:5e:00:02:64\",dst=\"33:33:00:00:00:12\")/IPv6(src=\"2001:db8::1\",dst=\"ff02::12\")/VRRPv3(vrid=100,ipcount=1,addrlist=[ \"2001:db8::100\" ]))\r\n```\r\n\r\n#### Actual result\r\n\r\n```\r\nTraceback (most recent call last):\r\n  File \"/Users/mgsmith/src/scapy/scapy/fields.py\", line 535, in h2i\r\n    inet_aton(x)\r\nOSError: illegal IP address string passed to inet_aton\r\n\r\nDuring handling of the above exception, another exception occurred:\r\n\r\nTraceback (most recent call last):\r\n  File \"<console>\", line 1, in <module>\r\n  File \"/Users/mgsmith/src/scapy/scapy/base_classes.py\", line 266, in __call__\r\n    i.__init__(*args, **kargs)\r\n  File \"/Users/mgsmith/src/scapy/scapy/packet.py\", line 157, in __init__\r\n    self.fields[fname] = self.get_field(fname).any2i(self, value)\r\n  File \"/Users/mgsmith/src/scapy/scapy/fields.py\", line 1412, in any2i\r\n    return [self.field.any2i(pkt, e) for e in x]\r\n  File \"/Users/mgsmith/src/scapy/scapy/fields.py\", line 1412, in <listcomp>\r\n    return [self.field.any2i(pkt, e) for e in x]\r\n  File \"/Users/mgsmith/src/scapy/scapy/fields.py\", line 562, in any2i\r\n    return self.h2i(pkt, x)\r\n  File \"/Users/mgsmith/src/scapy/scapy/fields.py\", line 537, in h2i\r\n    x = Net(x)\r\n  File \"/Users/mgsmith/src/scapy/scapy/base_classes.py\", line 108, in __init__\r\n    self.parsed, self.netmask = self._parse_net(net)\r\n  File \"/Users/mgsmith/src/scapy/scapy/base_classes.py\", line 101, in _parse_net\r\n    tmp[0] = socket.gethostbyname(tmp[0])\r\nsocket.gaierror: [Errno 8] nodename nor servname provided, or not known\r\n```\r\n\r\n#### Expected result\r\n\r\nNo error, valid packet created.\r\n\r\n#### Related resources\r\n\r\nRFC 5798\r\nI have a patch which adds this support which I will submit as a pull request. See https://github.com/mgsmith1000/scapy/commit/020a6695d48d16b5521bf78a4a1ef5efba14fd21.\r\n\n", "before_files": [{"content": "# This file is part of Scapy\n# See http://www.secdev.org/projects/scapy for more information\n# Copyright (C) Philippe Biondi <phil@secdev.org>\n# Copyright (C) 6WIND <olivier.matz@6wind.com>\n# This program is published under a GPLv2 license\n\n\"\"\"\nVRRP (Virtual Router Redundancy Protocol).\n\"\"\"\n\nfrom scapy.packet import Packet, bind_layers\nfrom scapy.fields import BitField, ByteField, FieldLenField, FieldListField, \\\n    IPField, IntField, XShortField\nfrom scapy.compat import chb, orb\nfrom scapy.layers.inet import IP, in4_chksum, checksum\nfrom scapy.layers.inet6 import IPv6, in6_chksum\nfrom scapy.error import warning\n\nIPPROTO_VRRP = 112\n\n# RFC 3768 - Virtual Router Redundancy Protocol (VRRP)\n\n\nclass VRRP(Packet):\n    fields_desc = [\n        BitField(\"version\", 2, 4),\n        BitField(\"type\", 1, 4),\n        ByteField(\"vrid\", 1),\n        ByteField(\"priority\", 100),\n        FieldLenField(\"ipcount\", None, count_of=\"addrlist\", fmt=\"B\"),\n        ByteField(\"authtype\", 0),\n        ByteField(\"adv\", 1),\n        XShortField(\"chksum\", None),\n        FieldListField(\"addrlist\", [], IPField(\"\", \"0.0.0.0\"),\n                       count_from=lambda pkt: pkt.ipcount),\n        IntField(\"auth1\", 0),\n        IntField(\"auth2\", 0)]\n\n    def post_build(self, p, pay):\n        if self.chksum is None:\n            ck = checksum(p)\n            p = p[:6] + chb(ck >> 8) + chb(ck & 0xff) + p[8:]\n        return p\n\n    @classmethod\n    def dispatch_hook(cls, _pkt=None, *args, **kargs):\n        if _pkt and len(_pkt) >= 9:\n            ver_n_type = orb(_pkt[0])\n            if ver_n_type >= 48 and ver_n_type <= 57:  # Version == 3\n                return VRRPv3\n        return VRRP\n\n\n# RFC 5798 -  Virtual Router Redundancy Protocol (VRRP) Version 3\nclass VRRPv3(Packet):\n    fields_desc = [\n        BitField(\"version\", 3, 4),\n        BitField(\"type\", 1, 4),\n        ByteField(\"vrid\", 1),\n        ByteField(\"priority\", 100),\n        FieldLenField(\"ipcount\", None, count_of=\"addrlist\", fmt=\"B\"),\n        BitField(\"res\", 0, 4),\n        BitField(\"adv\", 100, 12),\n        XShortField(\"chksum\", None),\n        # FIXME: addrlist should also allow IPv6 addresses :/\n        FieldListField(\"addrlist\", [], IPField(\"\", \"0.0.0.0\"),\n                       count_from=lambda pkt: pkt.ipcount)]\n\n    def post_build(self, p, pay):\n        if self.chksum is None:\n            if isinstance(self.underlayer, IP):\n                ck = in4_chksum(112, self.underlayer, p)\n            elif isinstance(self.underlayer, IPv6):\n                ck = in6_chksum(112, self.underlayer, p)\n            else:\n                warning(\"No IP(v6) layer to compute checksum on VRRP. Leaving null\")  # noqa: E501\n                ck = 0\n            p = p[:6] + chb(ck >> 8) + chb(ck & 0xff) + p[8:]\n        return p\n\n    @classmethod\n    def dispatch_hook(cls, _pkt=None, *args, **kargs):\n        if _pkt and len(_pkt) >= 16:\n            ver_n_type = orb(_pkt[0])\n            if ver_n_type < 48 or ver_n_type > 57:  # Version != 3\n                return VRRP\n        return VRRPv3\n\n\n# IPv6 is supported only on VRRPv3\n# Warning: those layers need to be un-binded in the CARP contrib module.\n# If you add/remove any, remember to also edit the one in CARP.py\nbind_layers(IP, VRRP, proto=IPPROTO_VRRP)\nbind_layers(IP, VRRPv3, proto=IPPROTO_VRRP)\nbind_layers(IPv6, VRRPv3, nh=IPPROTO_VRRP)\n", "path": "scapy/layers/vrrp.py"}], "after_files": [{"content": "# This file is part of Scapy\n# See http://www.secdev.org/projects/scapy for more information\n# Copyright (C) Philippe Biondi <phil@secdev.org>\n# Copyright (C) 6WIND <olivier.matz@6wind.com>\n# This program is published under a GPLv2 license\n\n\"\"\"\nVRRP (Virtual Router Redundancy Protocol).\n\"\"\"\n\nfrom scapy.packet import Packet, bind_layers\nfrom scapy.fields import BitField, ByteField, FieldLenField, FieldListField, \\\n    IPField, IP6Field, IntField, MultipleTypeField, StrField, XShortField\nfrom scapy.compat import chb, orb\nfrom scapy.layers.inet import IP, in4_chksum, checksum\nfrom scapy.layers.inet6 import IPv6, in6_chksum\nfrom scapy.error import warning\n\nIPPROTO_VRRP = 112\n\n# RFC 3768 - Virtual Router Redundancy Protocol (VRRP)\n\n\nclass VRRP(Packet):\n    fields_desc = [\n        BitField(\"version\", 2, 4),\n        BitField(\"type\", 1, 4),\n        ByteField(\"vrid\", 1),\n        ByteField(\"priority\", 100),\n        FieldLenField(\"ipcount\", None, count_of=\"addrlist\", fmt=\"B\"),\n        ByteField(\"authtype\", 0),\n        ByteField(\"adv\", 1),\n        XShortField(\"chksum\", None),\n        FieldListField(\"addrlist\", [], IPField(\"\", \"0.0.0.0\"),\n                       count_from=lambda pkt: pkt.ipcount),\n        IntField(\"auth1\", 0),\n        IntField(\"auth2\", 0)]\n\n    def post_build(self, p, pay):\n        if self.chksum is None:\n            ck = checksum(p)\n            p = p[:6] + chb(ck >> 8) + chb(ck & 0xff) + p[8:]\n        return p\n\n    @classmethod\n    def dispatch_hook(cls, _pkt=None, *args, **kargs):\n        if _pkt and len(_pkt) >= 9:\n            ver_n_type = orb(_pkt[0])\n            if ver_n_type >= 48 and ver_n_type <= 57:  # Version == 3\n                return VRRPv3\n        return VRRP\n\n\n# RFC 5798 -  Virtual Router Redundancy Protocol (VRRP) Version 3\nclass VRRPv3(Packet):\n    fields_desc = [\n        BitField(\"version\", 3, 4),\n        BitField(\"type\", 1, 4),\n        ByteField(\"vrid\", 1),\n        ByteField(\"priority\", 100),\n        FieldLenField(\"ipcount\", None, count_of=\"addrlist\", fmt=\"B\"),\n        BitField(\"res\", 0, 4),\n        BitField(\"adv\", 100, 12),\n        XShortField(\"chksum\", None),\n        MultipleTypeField(\n            [\n                (FieldListField(\"addrlist\", [], IPField(\"\", \"0.0.0.0\"),\n                                count_from=lambda pkt: pkt.ipcount),\n                 lambda p: isinstance(p.underlayer, IP)),\n                (FieldListField(\"addrlist\", [], IP6Field(\"\", \"::\"),\n                                count_from=lambda pkt: pkt.ipcount),\n                 lambda p: isinstance(p.underlayer, IPv6)),\n            ],\n            StrField(\"addrlist\", \"\")\n        )\n    ]\n\n    def post_build(self, p, pay):\n        if self.chksum is None:\n            if isinstance(self.underlayer, IP):\n                ck = in4_chksum(112, self.underlayer, p)\n            elif isinstance(self.underlayer, IPv6):\n                ck = in6_chksum(112, self.underlayer, p)\n            else:\n                warning(\"No IP(v6) layer to compute checksum on VRRP. Leaving null\")  # noqa: E501\n                ck = 0\n            p = p[:6] + chb(ck >> 8) + chb(ck & 0xff) + p[8:]\n        return p\n\n    @classmethod\n    def dispatch_hook(cls, _pkt=None, *args, **kargs):\n        if _pkt and len(_pkt) >= 16:\n            ver_n_type = orb(_pkt[0])\n            if ver_n_type < 48 or ver_n_type > 57:  # Version != 3\n                return VRRP\n        return VRRPv3\n\n\n# IPv6 is supported only on VRRPv3\n# Warning: those layers need to be un-binded in the CARP contrib module.\n# If you add/remove any, remember to also edit the one in CARP.py\nbind_layers(IP, VRRP, proto=IPPROTO_VRRP)\nbind_layers(IP, VRRPv3, proto=IPPROTO_VRRP)\nbind_layers(IPv6, VRRPv3, nh=IPPROTO_VRRP)\n", "path": "scapy/layers/vrrp.py"}]}