From 618298b1d9a5c6acc3b4f8a094c38368f9f4cf80 Mon Sep 17 00:00:00 2001 From: Trumeet Date: Sun, 4 Apr 2021 14:24:09 -0700 Subject: fix(central): does not allow peers with the same link local addresses with nodes Existing conflicts need to be removed manually --- .../src/main/java/moe/yuuta/dn42peering/manage/ManagementUI.java | 6 ++++++ central/src/main/resources/manage/form.ftlh | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/central/src/main/java/moe/yuuta/dn42peering/manage/ManagementUI.java b/central/src/main/java/moe/yuuta/dn42peering/manage/ManagementUI.java index 4f9954b..e77d0ed 100644 --- a/central/src/main/java/moe/yuuta/dn42peering/manage/ManagementUI.java +++ b/central/src/main/java/moe/yuuta/dn42peering/manage/ManagementUI.java @@ -103,6 +103,7 @@ class ManagementUI { root.put("mpbgp", false); root.put("node_checked", ((List>)root.get("nodes")).get(0).get("id")); } + root.put("ipv6_placeholder", "fe80::" + asn.substring(asn.length() - 4)); if(!newForm && peer != null) root.put("action", "/manage/edit?id=" + peer.getId()); else @@ -279,6 +280,11 @@ class ManagementUI { !address.isLinkLocal()) { errors.add("IPv6 address is illegal. It must be a dn42 or link-local IPv6 address."); } + if(node != null && + address.isLinkLocal() && + ipv6.equalsIgnoreCase(node.getDn42Ip6())) { + errors.add("Your IPv6 link local address must not be the same with ours. (Pick a different one)"); + } } else errors.add("IPv6 address is illegal. Cannot parse your address."); } else { diff --git a/central/src/main/resources/manage/form.ftlh b/central/src/main/resources/manage/form.ftlh index 021f26c..c407a9b 100644 --- a/central/src/main/resources/manage/form.ftlh +++ b/central/src/main/resources/manage/form.ftlh @@ -17,7 +17,7 @@



-- cgit v1.2.3