Skip to content

Commit

Permalink
Disallow IPv6 multicast as bridge n/w subnet
Browse files Browse the repository at this point in the history
Signed-off-by: Rob Murray <rob.murray@docker.com>
  • Loading branch information
robmry committed May 1, 2024
1 parent aa3a86c commit a5f82ba
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions libnetwork/drivers/bridge/bridge_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ func validateIPv6Subnet(addr netip.Prefix) error {
if !addr.Addr().Is6() || addr.Addr().Is4In6() {
return fmt.Errorf("'%s' is not a valid IPv6 subnet", addr)
}
if addr.Addr().IsMulticast() {
return fmt.Errorf("multicast subnet '%s' is not allowed", addr)
}
if addr.Masked() != linkLocalPrefix && linkLocalPrefix.Overlaps(addr) {
return fmt.Errorf("'%s' clashes with the Link-Local prefix 'fe80::/64'", addr)
}
Expand Down
5 changes: 5 additions & 0 deletions libnetwork/drivers/bridge/bridge_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1046,6 +1046,11 @@ func TestValidateFixedCIDRV6(t *testing.T) {
input: "nonsense",
expectedErr: "invalid fixed-cidr-v6: netip.ParsePrefix(\"nonsense\"): no '/'",
},
{
doc: "multicast IPv6 subnet",
input: "ff05::/64",
expectedErr: "invalid fixed-cidr-v6: multicast subnet 'ff05::/64' is not allowed",
},
}
for _, tc := range tests {
tc := tc
Expand Down

0 comments on commit a5f82ba

Please sign in to comment.