diff options
author | Trumeet <yuuta@yuuta.moe> | 2021-04-04 14:24:09 -0700 |
---|---|---|
committer | Trumeet <yuuta@yuuta.moe> | 2021-04-04 14:24:09 -0700 |
commit | 618298b1d9a5c6acc3b4f8a094c38368f9f4cf80 (patch) | |
tree | 2c2a35b5c8e95c61b808b01ec3926e255148ac12 | |
parent | a332a22ad3c0a9e358bf86b6ff62f1253ca91b8e (diff) | |
download | dn42peering-618298b1d9a5c6acc3b4f8a094c38368f9f4cf80.tar dn42peering-618298b1d9a5c6acc3b4f8a094c38368f9f4cf80.tar.gz dn42peering-618298b1d9a5c6acc3b4f8a094c38368f9f4cf80.tar.bz2 dn42peering-618298b1d9a5c6acc3b4f8a094c38368f9f4cf80.zip |
fix(central): does not allow peers with the same link local addresses with nodes
Existing conflicts need to be removed manually
-rw-r--r-- | central/src/main/java/moe/yuuta/dn42peering/manage/ManagementUI.java | 6 | ||||
-rw-r--r-- | central/src/main/resources/manage/form.ftlh | 2 |
2 files changed, 7 insertions, 1 deletions
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<Map<String, Object>>)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 @@ <br /> <label for="ipv6">dn42 or link local IPv6 Address (Optional):</label><br /> <input type="text" id="ipv6" name="ipv6" - placeholder="fe80::2980" + placeholder="${ipv6_placeholder}" value="${(ipv6)!}"><br /> <br /> <input type="checkbox" id="mpbgp" name="mpbgp" value="mpbgp" ${mpbgp?string('checked', '')}> |