Compare commits

...

2 Commits

Author SHA1 Message Date
Key Networks 16b0034cbf IPv6_route_del: version bump
3 years ago
lideming 2b1409e721 fix IPv6 route target comparing
3 years ago

@ -186,13 +186,9 @@ exports.routes = async function(nwid, route, action) {
const network = await network_detail(nwid); const network = await network_detail(nwid);
let routes = network.routes; let routes = network.routes;
const target6 = new ipaddr.Address6(route.target); route.target = canonicalTarget(route.target);
if (target6.isValid()) {
const parts = route.target.split('/');
route.target = target6.canonicalForm() + '/' + parts[1];
}
const route_to_del = routes.find(rt => rt.target === route.target); const route_to_del = routes.find(rt => canonicalTarget(rt.target) === route.target);
if (!route_to_del) { if (!route_to_del) {
if (action === 'add') { if (action === 'add') {
@ -220,6 +216,15 @@ exports.routes = async function(nwid, route, action) {
} }
} }
function canonicalTarget(target) {
const target6 = new ipaddr.Address6(target);
if (target6.isValid()) {
const parts = target.split('/');
return target6.canonicalForm() + '/' + parts[1];
}
return target;
}
exports.network_object = async function(nwid, object) { exports.network_object = async function(nwid, object) {
const options = await init_options(); const options = await init_options();
options.method = 'POST'; options.method = 'POST';

@ -1,6 +1,6 @@
{ {
"name": "ztncui", "name": "ztncui",
"version": "0.8.4", "version": "0.8.5",
"private": true, "private": true,
"scripts": { "scripts": {
"start": "node ./bin/www", "start": "node ./bin/www",

Loading…
Cancel
Save