@usex/mikrotik-mcp 6.8.0 → 6.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/cli.js +630 -25
- package/dist/index.js +1 -1
- package/dist/shared/{cli-ksq2qr7d.js → cli-0srgjr3v.js} +1 -1
- package/dist/shared/{cli-mh3kf1gx.js → cli-81s63cts.js} +124 -33
- package/dist/shared/{cli-qszw8tv2.js → cli-b4kkd56k.js} +1 -1
- package/dist/shared/{cli-pan4hpjf.js → cli-chcn79z7.js} +1 -1
- package/dist/shared/{cli-4a4dxv04.js → cli-twafzgn3.js} +1 -1
- package/dist/shared/{library-r8m6ftrj.js → library-2kk6k7zh.js} +1 -1
- package/dist/shared/{library-g8fvds7b.js → library-f89nvhan.js} +1 -1
- package/dist/shared/{library-5ejy1n1c.js → library-sxxt02xq.js} +1 -1
- package/dist/shared/{library-qwkp17zf.js → library-thv5s4bs.js} +112 -21
- package/dist/shared/{library-qdh9kmg5.js → library-x66xvb3s.js} +1 -1
- package/dist/ui/observability.html +78 -86
- package/package.json +8 -8
- package/schemas/README.md +1 -1
- package/schemas/devtools-manifest.json +23 -1
- package/schemas/tool-catalog.json +148 -5
- package/schemas/tools/add_bridge_port.json +4 -0
- package/schemas/tools/add_dot1x_server.json +4 -0
- package/schemas/tools/add_wireguard_peer.json +6 -0
- package/schemas/tools/create_bridge.json +21 -0
- package/schemas/tools/create_dhcp_server.json +4 -0
- package/schemas/tools/create_ipv6_dhcp_server.json +8 -0
- package/schemas/tools/create_vlan_interface.json +4 -0
- package/schemas/tools/list_bgp_instances.json +7 -0
- package/schemas/tools/update_bgp_instance_med_comparison.json +22 -0
- package/schemas/tools/update_bridge.json +21 -0
- package/schemas/tools/update_dot1x_server.json +4 -0
- package/schemas/tools/update_vlan_interface.json +4 -0
- package/schemas/tools/update_wireguard_peer.json +17 -3
|
@@ -15606,13 +15606,13 @@ async function undoMigration(id, confirm, selected) {
|
|
|
15606
15606
|
throw new Error("Undo lost Safe Mode or exceeded its time budget.");
|
|
15607
15607
|
await checkedRead(item.undo, createContext(undefined, device));
|
|
15608
15608
|
}
|
|
15609
|
-
const beforeTarget = (await import("./library-
|
|
15610
|
-
const db = await beforeTarget((await import("./library-
|
|
15609
|
+
const beforeTarget = (await import("./library-f89nvhan.js")).openSnapshotStore;
|
|
15610
|
+
const db = await beforeTarget((await import("./library-x66xvb3s.js")).DEFAULT_SNAPSHOT_DB);
|
|
15611
15611
|
try {
|
|
15612
15612
|
const original = db.get(p.snapshots.target);
|
|
15613
15613
|
if (!original)
|
|
15614
15614
|
throw new Error("Original target snapshot unavailable.");
|
|
15615
|
-
const { normalizeExport } = await import("./library-
|
|
15615
|
+
const { normalizeExport } = await import("./library-sxxt02xq.js");
|
|
15616
15616
|
if (normalizeExport((await migrationInventory(device)).export) !== normalizeExport(original.body))
|
|
15617
15617
|
throw new Error("Target differs from its backup. Undo verification failed.");
|
|
15618
15618
|
} finally {
|
|
@@ -17547,10 +17547,15 @@ function decodeRecord(buf, offset, template, ctx, warnings) {
|
|
|
17547
17547
|
break;
|
|
17548
17548
|
}
|
|
17549
17549
|
}
|
|
17550
|
-
if (record.start === 0 && relativeStart !== undefined)
|
|
17551
|
-
record.
|
|
17552
|
-
|
|
17553
|
-
|
|
17550
|
+
if (ctx.version === 10 && record.start === 0 && record.end === 0 && relativeStart !== undefined && relativeEnd !== undefined) {
|
|
17551
|
+
record.end = ctx.receivedAt;
|
|
17552
|
+
record.start = record.end - Math.max(0, relativeEnd - relativeStart);
|
|
17553
|
+
} else {
|
|
17554
|
+
if (record.start === 0 && relativeStart !== undefined)
|
|
17555
|
+
record.start = bootTime + relativeStart;
|
|
17556
|
+
if (record.end === 0 && relativeEnd !== undefined)
|
|
17557
|
+
record.end = bootTime + relativeEnd;
|
|
17558
|
+
}
|
|
17554
17559
|
if (record.start === 0)
|
|
17555
17560
|
record.start = ctx.unixSecs > 0 ? ctx.unixSecs * 1000 : ctx.receivedAt;
|
|
17556
17561
|
if (record.end === 0)
|
|
@@ -17846,6 +17851,7 @@ class FlowCollector {
|
|
|
17846
17851
|
decoder = new ExporterFlowDecoder;
|
|
17847
17852
|
store = null;
|
|
17848
17853
|
queue = [];
|
|
17854
|
+
subscribers = new Set;
|
|
17849
17855
|
flushTimer = null;
|
|
17850
17856
|
pruneTimer = null;
|
|
17851
17857
|
packets = 0;
|
|
@@ -17938,6 +17944,13 @@ class FlowCollector {
|
|
|
17938
17944
|
this.queue = [];
|
|
17939
17945
|
try {
|
|
17940
17946
|
this.store.insert(batch);
|
|
17947
|
+
for (const subscriber of this.subscribers) {
|
|
17948
|
+
try {
|
|
17949
|
+
subscriber(batch);
|
|
17950
|
+
} catch (e) {
|
|
17951
|
+
logger.warn(`Flow activity subscriber failed: ${String(e)}`);
|
|
17952
|
+
}
|
|
17953
|
+
}
|
|
17941
17954
|
} catch (e) {
|
|
17942
17955
|
this.storageDropped += batch.length;
|
|
17943
17956
|
logger.error(`Flow store insert failed (${batch.length} records dropped): ${String(e)}`);
|
|
@@ -17973,6 +17986,10 @@ class FlowCollector {
|
|
|
17973
17986
|
drain() {
|
|
17974
17987
|
this.flush();
|
|
17975
17988
|
}
|
|
17989
|
+
subscribe(subscriber) {
|
|
17990
|
+
this.subscribers.add(subscriber);
|
|
17991
|
+
return () => this.subscribers.delete(subscriber);
|
|
17992
|
+
}
|
|
17976
17993
|
}
|
|
17977
17994
|
var collector = new FlowCollector;
|
|
17978
17995
|
function getFlowCollector() {
|
|
@@ -23757,6 +23774,11 @@ var bridgeTools = [
|
|
|
23757
23774
|
frame_types: FrameTypes.optional().describe("Default accepted frame types for ports"),
|
|
23758
23775
|
ingress_filtering: boolean().optional().describe("Default ingress VLAN filtering for ports"),
|
|
23759
23776
|
dhcp_snooping: boolean().optional().describe("Enable DHCP snooping"),
|
|
23777
|
+
arp_inspection: boolean().optional().describe("RouterOS 7.25+ validate ARP against DHCP snooping bindings"),
|
|
23778
|
+
ip_source_guard: boolean().optional().describe("RouterOS 7.25+ validate IPv4 source against DHCP snooping bindings"),
|
|
23779
|
+
mlag_init_delay: string().optional().describe("RouterOS 7.25+ MLAG LACP initialization delay"),
|
|
23780
|
+
mlag_lacp_fallback: boolean().optional().describe("RouterOS 7.25+ MLAG LACP fallback after peer loss"),
|
|
23781
|
+
confirm_security_disruption: literal(true).optional().describe("Required when enabling ARP inspection or IP source guard; DHCP bindings may be cleared and traffic interrupted"),
|
|
23760
23782
|
igmp_snooping: boolean().optional().describe("Enable IGMP/MLD snooping"),
|
|
23761
23783
|
fast_forward: boolean().optional().describe("Enable Fast Forward optimization"),
|
|
23762
23784
|
mvrp: boolean().optional().describe("Enable Multiple VLAN Registration Protocol"),
|
|
@@ -23765,8 +23787,10 @@ var bridgeTools = [
|
|
|
23765
23787
|
transmit_hold_count: number().int().optional().describe("STP transmit hold count")
|
|
23766
23788
|
},
|
|
23767
23789
|
async handler(a, ctx) {
|
|
23790
|
+
if ((a.arp_inspection || a.ip_source_guard) && !a.confirm_security_disruption)
|
|
23791
|
+
return "Enabling ARP inspection or IP source guard can clear DHCP bindings and interrupt clients. Review DHCP snooping and trusted ports, then set confirm_security_disruption=true.";
|
|
23768
23792
|
ctx.info(`Creating bridge: name=${a.name}, vlan_filtering=${a.vlan_filtering}`);
|
|
23769
|
-
const cmd = new Cmd("/interface bridge add").set("name", a.name).opt("comment", a.comment).flag("vlan-filtering", a.vlan_filtering).opt("protocol-mode", a.protocol_mode).opt("mtu", a.mtu).opt("ageing-time", a.ageing_time).opt("arp", a.arp).opt("arp-timeout", a.arp_timeout).bool("auto-mac", a.auto_mac).opt("admin-mac", a.admin_mac).opt("priority", a.priority).opt("ether-type", a.ether_type).opt("pvid", a.pvid).opt("frame-types", a.frame_types).bool("ingress-filtering", a.ingress_filtering).bool("dhcp-snooping", a.dhcp_snooping).bool("igmp-snooping", a.igmp_snooping).bool("fast-forward", a.fast_forward).bool("mvrp", a.mvrp).opt("forward-delay", a.forward_delay).opt("max-message-age", a.max_message_age).opt("transmit-hold-count", a.transmit_hold_count).flag("disabled", a.disabled).build();
|
|
23793
|
+
const cmd = new Cmd("/interface bridge add").set("name", a.name).opt("comment", a.comment).flag("vlan-filtering", a.vlan_filtering).opt("protocol-mode", a.protocol_mode).opt("mtu", a.mtu).opt("ageing-time", a.ageing_time).opt("arp", a.arp).opt("arp-timeout", a.arp_timeout).bool("auto-mac", a.auto_mac).opt("admin-mac", a.admin_mac).opt("priority", a.priority).opt("ether-type", a.ether_type).opt("pvid", a.pvid).opt("frame-types", a.frame_types).bool("ingress-filtering", a.ingress_filtering).bool("dhcp-snooping", a.dhcp_snooping).bool("arp-inspection", a.arp_inspection).bool("ip-source-guard", a.ip_source_guard).opt("mlag-init-delay", a.mlag_init_delay).bool("mlag-lacp-fallback", a.mlag_lacp_fallback).bool("igmp-snooping", a.igmp_snooping).bool("fast-forward", a.fast_forward).bool("mvrp", a.mvrp).opt("forward-delay", a.forward_delay).opt("max-message-age", a.max_message_age).opt("transmit-hold-count", a.transmit_hold_count).flag("disabled", a.disabled).build();
|
|
23770
23794
|
const result = await executeMikrotikCommand2(cmd, ctx);
|
|
23771
23795
|
if (looksLikeError(result))
|
|
23772
23796
|
return `Failed to create bridge: ${result}`;
|
|
@@ -23833,6 +23857,11 @@ ${result}`;
|
|
|
23833
23857
|
frame_types: FrameTypes.optional().describe("Default accepted frame types for ports"),
|
|
23834
23858
|
ingress_filtering: boolean().optional().describe("Default ingress VLAN filtering for ports"),
|
|
23835
23859
|
dhcp_snooping: boolean().optional().describe("Enable DHCP snooping"),
|
|
23860
|
+
arp_inspection: boolean().optional().describe("RouterOS 7.25+ validate ARP against DHCP snooping bindings"),
|
|
23861
|
+
ip_source_guard: boolean().optional().describe("RouterOS 7.25+ validate IPv4 source against DHCP snooping bindings"),
|
|
23862
|
+
mlag_init_delay: string().optional().describe("RouterOS 7.25+ MLAG LACP initialization delay"),
|
|
23863
|
+
mlag_lacp_fallback: boolean().optional().describe("RouterOS 7.25+ MLAG LACP fallback after peer loss"),
|
|
23864
|
+
confirm_security_disruption: literal(true).optional().describe("Required when enabling ARP inspection or IP source guard; DHCP bindings may be cleared and traffic interrupted"),
|
|
23836
23865
|
igmp_snooping: boolean().optional().describe("Enable IGMP/MLD snooping"),
|
|
23837
23866
|
fast_forward: boolean().optional().describe("Enable Fast Forward optimization"),
|
|
23838
23867
|
mvrp: boolean().optional().describe("Enable Multiple VLAN Registration Protocol"),
|
|
@@ -23841,15 +23870,17 @@ ${result}`;
|
|
|
23841
23870
|
transmit_hold_count: number().int().optional().describe("STP transmit hold count")
|
|
23842
23871
|
},
|
|
23843
23872
|
async handler(a, ctx) {
|
|
23873
|
+
if ((a.arp_inspection || a.ip_source_guard) && !a.confirm_security_disruption)
|
|
23874
|
+
return "Enabling ARP inspection or IP source guard can clear DHCP bindings and interrupt clients. Review DHCP snooping and trusted ports, then set confirm_security_disruption=true.";
|
|
23844
23875
|
ctx.info(`Updating bridge: name=${a.name}`);
|
|
23845
|
-
const cmd = new Cmd(`/interface bridge set [find name
|
|
23876
|
+
const cmd = new Cmd(`/interface bridge set [find name=${quoteValue(a.name)}]`).opt("name", a.new_name).opt("comment", a.comment).bool("vlan-filtering", a.vlan_filtering).opt("protocol-mode", a.protocol_mode).bool("disabled", a.disabled).opt("mtu", a.mtu).opt("ageing-time", a.ageing_time).opt("arp", a.arp).opt("arp-timeout", a.arp_timeout).bool("auto-mac", a.auto_mac).opt("admin-mac", a.admin_mac).opt("priority", a.priority).opt("ether-type", a.ether_type).opt("pvid", a.pvid).opt("frame-types", a.frame_types).bool("ingress-filtering", a.ingress_filtering).bool("dhcp-snooping", a.dhcp_snooping).bool("arp-inspection", a.arp_inspection).bool("ip-source-guard", a.ip_source_guard).opt("mlag-init-delay", a.mlag_init_delay).bool("mlag-lacp-fallback", a.mlag_lacp_fallback).bool("igmp-snooping", a.igmp_snooping).bool("fast-forward", a.fast_forward).bool("mvrp", a.mvrp).opt("forward-delay", a.forward_delay).opt("max-message-age", a.max_message_age).opt("transmit-hold-count", a.transmit_hold_count).build();
|
|
23846
23877
|
if (!cmd.includes("=", cmd.indexOf("]")))
|
|
23847
23878
|
return "No updates specified.";
|
|
23848
23879
|
const result = await executeMikrotikCommand2(cmd, ctx);
|
|
23849
23880
|
if (looksLikeError(result))
|
|
23850
23881
|
return `Failed to update bridge: ${result}`;
|
|
23851
23882
|
const target = a.new_name ?? a.name;
|
|
23852
|
-
const details = await executeMikrotikCommand2(
|
|
23883
|
+
const details = await executeMikrotikCommand2(new Cmd("/interface bridge print detail where").set("name", target).build(), ctx);
|
|
23853
23884
|
return `Bridge updated successfully:
|
|
23854
23885
|
|
|
23855
23886
|
${details}`;
|
|
@@ -23899,6 +23930,7 @@ ${details}`;
|
|
|
23899
23930
|
restricted_role: boolean().optional().describe("Exclude port from becoming the root port"),
|
|
23900
23931
|
restricted_tcn: boolean().optional().describe("Block topology change notifications from this port"),
|
|
23901
23932
|
trusted: boolean().optional().describe("Trust DHCP server replies on this port (DHCP snooping)"),
|
|
23933
|
+
trusted_arp: boolean().optional().describe("RouterOS 7.25+ exempt this port from ARP inspection"),
|
|
23902
23934
|
multicast_router: MulticastRouter.optional().describe("IGMP-snooping multicast router state"),
|
|
23903
23935
|
fast_leave: boolean().optional().describe("IGMP-snooping fast leave"),
|
|
23904
23936
|
unknown_unicast_flood: boolean().optional().describe("Flood unknown-unicast frames to this port"),
|
|
@@ -23907,7 +23939,7 @@ ${details}`;
|
|
|
23907
23939
|
},
|
|
23908
23940
|
async handler(a, ctx) {
|
|
23909
23941
|
ctx.info(`Adding bridge port: bridge=${a.bridge}, interface=${a.interface}`);
|
|
23910
|
-
const cmd = new Cmd("/interface bridge port add").set("bridge", a.bridge).set("interface", a.interface).opt("pvid", a.pvid).opt("comment", a.comment).bool("hw", a.hw).bool("disabled", a.disabled).opt("frame-types", a.frame_types).bool("ingress-filtering", a.ingress_filtering).bool("tag-stacking", a.tag_stacking).opt("priority", a.priority).opt("path-cost", a.path_cost).opt("internal-path-cost", a.internal_path_cost).opt("horizon", a.horizon).opt("learn", a.learn).opt("edge", a.edge).opt("point-to-point", a.point_to_point).bool("auto-isolate", a.auto_isolate).bool("bpdu-guard", a.bpdu_guard).bool("restricted-role", a.restricted_role).bool("restricted-tcn", a.restricted_tcn).bool("trusted", a.trusted).opt("multicast-router", a.multicast_router).bool("fast-leave", a.fast_leave).bool("unknown-unicast-flood", a.unknown_unicast_flood).bool("unknown-multicast-flood", a.unknown_multicast_flood).bool("broadcast-flood", a.broadcast_flood).build();
|
|
23942
|
+
const cmd = new Cmd("/interface bridge port add").set("bridge", a.bridge).set("interface", a.interface).opt("pvid", a.pvid).opt("comment", a.comment).bool("hw", a.hw).bool("disabled", a.disabled).opt("frame-types", a.frame_types).bool("ingress-filtering", a.ingress_filtering).bool("tag-stacking", a.tag_stacking).opt("priority", a.priority).opt("path-cost", a.path_cost).opt("internal-path-cost", a.internal_path_cost).opt("horizon", a.horizon).opt("learn", a.learn).opt("edge", a.edge).opt("point-to-point", a.point_to_point).bool("auto-isolate", a.auto_isolate).bool("bpdu-guard", a.bpdu_guard).bool("restricted-role", a.restricted_role).bool("restricted-tcn", a.restricted_tcn).bool("trusted", a.trusted).bool("trusted-arp", a.trusted_arp).opt("multicast-router", a.multicast_router).bool("fast-leave", a.fast_leave).bool("unknown-unicast-flood", a.unknown_unicast_flood).bool("unknown-multicast-flood", a.unknown_multicast_flood).bool("broadcast-flood", a.broadcast_flood).build();
|
|
23911
23943
|
const result = await executeMikrotikCommand2(cmd, ctx);
|
|
23912
23944
|
if (looksLikeError(result))
|
|
23913
23945
|
return `Failed to add bridge port: ${result}`;
|
|
@@ -26550,6 +26582,7 @@ var dhcpTools = [
|
|
|
26550
26582
|
delay_threshold: string().optional(),
|
|
26551
26583
|
add_arp: boolean().optional().describe("Add dynamic ARP entry for each lease (use with reply-only ARP on the interface)"),
|
|
26552
26584
|
always_broadcast: boolean().optional().describe("Always send replies as broadcast"),
|
|
26585
|
+
ipv6_only_preferred: boolean().optional().describe("RouterOS 7.25+ advertise DHCP option 108 for IPv6-only preferred clients"),
|
|
26553
26586
|
bootp_support: _enum(["none", "static", "dynamic"]).optional().describe("Which BOOTP requests to answer"),
|
|
26554
26587
|
conflict_detection: boolean().optional().describe("Ping/ARP-probe an address before offering it to detect conflicts"),
|
|
26555
26588
|
use_radius: _enum(["yes", "no", "accounting"]).optional().describe("Use RADIUS for leases (accounting = RADIUS accounting only)"),
|
|
@@ -26560,7 +26593,7 @@ var dhcpTools = [
|
|
|
26560
26593
|
},
|
|
26561
26594
|
async handler(a, ctx) {
|
|
26562
26595
|
ctx.info(`Creating DHCP server: name=${a.name}, interface=${a.interface}`);
|
|
26563
|
-
const cmd = new Cmd("/ip dhcp-server add").set("name", a.name).set("interface", a.interface).set("lease-time", a.lease_time).opt("address-pool", a.address_pool).flag("disabled", a.disabled).raw(a.authoritative !== "yes" ? `authoritative=${a.authoritative}` : null).opt("delay-threshold", a.delay_threshold).bool("add-arp", a.add_arp).bool("always-broadcast", a.always_broadcast).opt("bootp-support", a.bootp_support).bool("conflict-detection", a.conflict_detection).opt("use-radius", a.use_radius).opt("relay", a.relay).opt("server-address", a.server_address).opt("lease-script", a.lease_script).opt("comment", a.comment).build();
|
|
26596
|
+
const cmd = new Cmd("/ip dhcp-server add").set("name", a.name).set("interface", a.interface).set("lease-time", a.lease_time).opt("address-pool", a.address_pool).flag("disabled", a.disabled).raw(a.authoritative !== "yes" ? `authoritative=${a.authoritative}` : null).opt("delay-threshold", a.delay_threshold).bool("add-arp", a.add_arp).bool("always-broadcast", a.always_broadcast).bool("ipv6-only-preferred", a.ipv6_only_preferred).opt("bootp-support", a.bootp_support).bool("conflict-detection", a.conflict_detection).opt("use-radius", a.use_radius).opt("relay", a.relay).opt("server-address", a.server_address).opt("lease-script", a.lease_script).opt("comment", a.comment).build();
|
|
26564
26597
|
const result = await executeMikrotikCommand2(cmd, ctx);
|
|
26565
26598
|
if (looksLikeError(result))
|
|
26566
26599
|
return `Failed to create DHCP server: ${result}`;
|
|
@@ -28141,7 +28174,7 @@ var cache3 = null;
|
|
|
28141
28174
|
async function gateway() {
|
|
28142
28175
|
if (cache3)
|
|
28143
28176
|
return cache3;
|
|
28144
|
-
const { moduleCatalog } = await import("./library-
|
|
28177
|
+
const { moduleCatalog } = await import("./library-2kk6k7zh.js");
|
|
28145
28178
|
const forIndex = [];
|
|
28146
28179
|
const byName = new Map;
|
|
28147
28180
|
for (const mod of moduleCatalog) {
|
|
@@ -28863,12 +28896,15 @@ var dot1xServerTools = [
|
|
|
28863
28896
|
reject_vlan_id: string().optional().describe("VLAN id or 'none'"),
|
|
28864
28897
|
server_fail_vlan_id: string().optional().describe("VLAN id or 'none'"),
|
|
28865
28898
|
reauth_timeout: string().optional().describe("Re-auth period or 'none'"),
|
|
28899
|
+
reauth_period: string().optional().describe("RouterOS 7.25+ re-authentication period"),
|
|
28866
28900
|
comment: string().optional(),
|
|
28867
28901
|
disabled: boolean().default(false)
|
|
28868
28902
|
},
|
|
28869
28903
|
async handler(a, ctx) {
|
|
28904
|
+
if (a.reauth_period !== undefined && a.reauth_timeout !== undefined)
|
|
28905
|
+
return "Specify either reauth_period (RouterOS 7.25+) or reauth_timeout (older RouterOS), not both.";
|
|
28870
28906
|
ctx.info(`Adding dot1x server: interface=${a.interface}`);
|
|
28871
|
-
const cmd = new Cmd("/interface dot1x server add").set("interface", a.interface).opt("auth-types", a.auth_types).bool("accounting", a.accounting).opt("interim-update", a.interim_update).opt("mac-auth-mode", a.mac_auth_mode).opt("guest-vlan-id", a.guest_vlan_id).opt("reject-vlan-id", a.reject_vlan_id).opt("server-fail-vlan-id", a.server_fail_vlan_id).opt("reauth-timeout", a.reauth_timeout).opt("comment", a.comment).flag("disabled", a.disabled).build();
|
|
28907
|
+
const cmd = new Cmd("/interface dot1x server add").set("interface", a.interface).opt("auth-types", a.auth_types).bool("accounting", a.accounting).opt("interim-update", a.interim_update).opt("mac-auth-mode", a.mac_auth_mode).opt("guest-vlan-id", a.guest_vlan_id).opt("reject-vlan-id", a.reject_vlan_id).opt("server-fail-vlan-id", a.server_fail_vlan_id).opt("reauth-timeout", a.reauth_timeout).opt("reauth-period", a.reauth_period).opt("comment", a.comment).flag("disabled", a.disabled).build();
|
|
28872
28908
|
const result = await executeMikrotikCommand2(cmd, ctx);
|
|
28873
28909
|
if (looksLikeError(result))
|
|
28874
28910
|
return `Failed to add dot1x server: ${result}`;
|
|
@@ -28934,14 +28970,18 @@ ${result}`;
|
|
|
28934
28970
|
reject_vlan_id: string().optional(),
|
|
28935
28971
|
server_fail_vlan_id: string().optional(),
|
|
28936
28972
|
reauth_timeout: string().optional(),
|
|
28973
|
+
reauth_period: string().optional().describe("RouterOS 7.25+ re-authentication period"),
|
|
28937
28974
|
comment: string().optional(),
|
|
28938
28975
|
disabled: boolean().optional()
|
|
28939
28976
|
},
|
|
28940
28977
|
async handler(a, ctx) {
|
|
28978
|
+
if (a.reauth_period !== undefined && a.reauth_timeout !== undefined)
|
|
28979
|
+
return "Specify either reauth_period (RouterOS 7.25+) or reauth_timeout (older RouterOS), not both.";
|
|
28941
28980
|
ctx.info(`Updating dot1x server: server_id=${a.server_id}`);
|
|
28942
28981
|
const selector = a.server_id.startsWith("*") ? `.id="${a.server_id}"` : `interface="${a.server_id}"`;
|
|
28943
28982
|
const base = `/interface dot1x server set [find ${selector}]`;
|
|
28944
28983
|
const cmd = new Cmd(base).opt("auth-types", a.auth_types).bool("accounting", a.accounting).opt("interim-update", a.interim_update).opt("mac-auth-mode", a.mac_auth_mode).opt("guest-vlan-id", a.guest_vlan_id).opt("reject-vlan-id", a.reject_vlan_id).opt("server-fail-vlan-id", a.server_fail_vlan_id).opt("reauth-timeout", a.reauth_timeout);
|
|
28984
|
+
cmd.opt("reauth-period", a.reauth_period);
|
|
28945
28985
|
if (a.comment !== undefined)
|
|
28946
28986
|
cmd.raw(`comment=${quoteValue(a.comment)}`);
|
|
28947
28987
|
if (a.disabled !== undefined)
|
|
@@ -35618,6 +35658,8 @@ var ipv6DhcpServerTools = [
|
|
|
35618
35658
|
lease_time: string().default("3d").describe("Lease duration e.g. '1d', '12h', '30m'"),
|
|
35619
35659
|
binding_script: string().optional(),
|
|
35620
35660
|
rapid_commit: boolean().optional(),
|
|
35661
|
+
add_dns_entries: boolean().optional().describe("RouterOS 7.25+ create AAAA DNS entries for client FQDNs"),
|
|
35662
|
+
add_dns_entries_suffix: string().optional().describe("Suffix for dynamically created DHCPv6 DNS entries"),
|
|
35621
35663
|
preference: number().int().min(0).max(255).optional(),
|
|
35622
35664
|
route_distance: number().int().optional(),
|
|
35623
35665
|
use_radius: boolean().optional().describe("Authenticate clients via RADIUS"),
|
|
@@ -35629,7 +35671,7 @@ var ipv6DhcpServerTools = [
|
|
|
35629
35671
|
},
|
|
35630
35672
|
async handler(a, ctx) {
|
|
35631
35673
|
ctx.info(`Creating DHCPv6 server: name=${a.name}, interface=${a.interface}`);
|
|
35632
|
-
const cmd = new Cmd("/ipv6 dhcp-server add").set("name", a.name).set("interface", a.interface).set("address-pool", a.address_pool).set("lease-time", a.lease_time).opt("binding-script", a.binding_script).bool("rapid-commit", a.rapid_commit).opt("preference", a.preference).opt("route-distance", a.route_distance).bool("use-radius", a.use_radius).bool("allow-dual-stack-queue", a.allow_dual_stack_queue).opt("parent-queue", a.parent_queue).opt("dhcp-option", a.dhcp_option?.length ? a.dhcp_option.join(",") : undefined).opt("comment", a.comment).flag("disabled", a.disabled).build();
|
|
35674
|
+
const cmd = new Cmd("/ipv6 dhcp-server add").set("name", a.name).set("interface", a.interface).set("address-pool", a.address_pool).set("lease-time", a.lease_time).opt("binding-script", a.binding_script).bool("rapid-commit", a.rapid_commit).bool("add-dns-entries", a.add_dns_entries).opt("add-dns-entries-suffix", a.add_dns_entries_suffix).opt("preference", a.preference).opt("route-distance", a.route_distance).bool("use-radius", a.use_radius).bool("allow-dual-stack-queue", a.allow_dual_stack_queue).opt("parent-queue", a.parent_queue).opt("dhcp-option", a.dhcp_option?.length ? a.dhcp_option.join(",") : undefined).opt("comment", a.comment).flag("disabled", a.disabled).build();
|
|
35633
35675
|
const result = await executeMikrotikCommand2(cmd, ctx);
|
|
35634
35676
|
if (looksLikeError(result))
|
|
35635
35677
|
return `Failed to create DHCPv6 server: ${result}`;
|
|
@@ -48508,6 +48550,51 @@ ${result}`;
|
|
|
48508
48550
|
// src/tools/routing-bgp.ts
|
|
48509
48551
|
var UNSUPPORTED2 = "BGP is not available on this device (requires RouterOS v7 with the routing package).";
|
|
48510
48552
|
var routingBgpTools = [
|
|
48553
|
+
defineTool2({
|
|
48554
|
+
name: "list_bgp_instances",
|
|
48555
|
+
title: "List BGP Instances",
|
|
48556
|
+
annotations: READ,
|
|
48557
|
+
description: "Read BGP instances and their best-path selection settings, including RouterOS 7.25+ always-compare-med. Use before changing an instance.",
|
|
48558
|
+
async handler(_a, ctx) {
|
|
48559
|
+
const result = await executeMikrotikCommand2("/routing bgp instance print detail", ctx);
|
|
48560
|
+
if (commandUnsupported(result))
|
|
48561
|
+
return UNSUPPORTED2;
|
|
48562
|
+
return isEmpty(result) ? "No BGP instances found." : `BGP INSTANCES:
|
|
48563
|
+
|
|
48564
|
+
${result}`;
|
|
48565
|
+
}
|
|
48566
|
+
}),
|
|
48567
|
+
defineTool2({
|
|
48568
|
+
name: "update_bgp_instance_med_comparison",
|
|
48569
|
+
title: "Set BGP Instance MED Comparison",
|
|
48570
|
+
annotations: WRITE_IDEMPOTENT,
|
|
48571
|
+
description: "Set RouterOS 7.25+ always-compare-med on one named BGP instance. This changes best-path selection and can reroute traffic; inspect list_bgp_instances and obtain operator approval first.",
|
|
48572
|
+
inputSchema: {
|
|
48573
|
+
name: string().min(1).describe("Exact BGP instance name"),
|
|
48574
|
+
always_compare_med: boolean(),
|
|
48575
|
+
confirm_routing_change: literal(true).describe("Operator approved the best-path behavior change")
|
|
48576
|
+
},
|
|
48577
|
+
async handler(a, ctx) {
|
|
48578
|
+
const selector = new Cmd("/routing bgp instance print count-only where").set("name", a.name).build();
|
|
48579
|
+
const count = await executeMikrotikCommand2(selector, ctx);
|
|
48580
|
+
if (commandUnsupported(count))
|
|
48581
|
+
return UNSUPPORTED2;
|
|
48582
|
+
if (looksLikeError(count))
|
|
48583
|
+
return `Failed to inspect BGP instance: ${count}`;
|
|
48584
|
+
if (isEmpty(count) || count.trim() === "0")
|
|
48585
|
+
return `BGP instance '${a.name}' not found.`;
|
|
48586
|
+
const cmd = new Cmd(`/routing bgp instance set [find name=${quoteValue(a.name)}]`).bool("always-compare-med", a.always_compare_med).build();
|
|
48587
|
+
const result = await executeMikrotikCommand2(cmd, ctx);
|
|
48588
|
+
if (looksLikeError(result))
|
|
48589
|
+
return `Failed to update BGP instance: ${result}`;
|
|
48590
|
+
const details = await executeMikrotikCommand2(new Cmd("/routing bgp instance print detail where").set("name", a.name).build(), ctx);
|
|
48591
|
+
if (looksLikeError(details) || isEmpty(details))
|
|
48592
|
+
return `BGP instance update was sent, but read-back failed: ${details || "no details returned"}`;
|
|
48593
|
+
return `BGP instance '${a.name}' MED comparison updated:
|
|
48594
|
+
|
|
48595
|
+
${details}`;
|
|
48596
|
+
}
|
|
48597
|
+
}),
|
|
48511
48598
|
defineTool2({
|
|
48512
48599
|
name: "list_bgp_connections",
|
|
48513
48600
|
title: "List BGP Connections",
|
|
@@ -53317,7 +53404,7 @@ var riskByTool = null;
|
|
|
53317
53404
|
async function riskIndex() {
|
|
53318
53405
|
if (riskByTool)
|
|
53319
53406
|
return riskByTool;
|
|
53320
|
-
const { moduleCatalog } = await import("./library-
|
|
53407
|
+
const { moduleCatalog } = await import("./library-2kk6k7zh.js");
|
|
53321
53408
|
const index = new Map;
|
|
53322
53409
|
for (const mod of moduleCatalog) {
|
|
53323
53410
|
for (const tool of mod.tools)
|
|
@@ -60190,6 +60277,7 @@ var vlanTools = [
|
|
|
60190
60277
|
comment: string().optional(),
|
|
60191
60278
|
disabled: boolean().default(false),
|
|
60192
60279
|
mtu: number().int().optional(),
|
|
60280
|
+
forced_mac_address: string().optional().describe("RouterOS 7.25+ forced VLAN interface MAC address"),
|
|
60193
60281
|
use_service_tag: boolean().default(false).describe("Use 802.1ad service tag (QinQ)"),
|
|
60194
60282
|
arp: ArpMode2.default("enabled"),
|
|
60195
60283
|
arp_timeout: string().optional(),
|
|
@@ -60199,7 +60287,7 @@ var vlanTools = [
|
|
|
60199
60287
|
},
|
|
60200
60288
|
async handler(a, ctx) {
|
|
60201
60289
|
ctx.info(`Creating VLAN interface: name=${a.name}, vlan_id=${a.vlan_id}, interface=${a.interface}`);
|
|
60202
|
-
const cmd = new Cmd("/interface vlan add").set("name", a.name).set("vlan-id", a.vlan_id).set("interface", a.interface).opt("comment", a.comment).flag("disabled", a.disabled).opt("mtu", a.mtu).flag("use-service-tag", a.use_service_tag).raw(a.arp !== "enabled" ? `arp=${a.arp}` : null).opt("arp-timeout", a.arp_timeout).opt("loop-protect", a.loop_protect).opt("loop-protect-disable-time", a.loop_protect_disable_time).opt("loop-protect-send-interval", a.loop_protect_send_interval).build();
|
|
60290
|
+
const cmd = new Cmd("/interface vlan add").set("name", a.name).set("vlan-id", a.vlan_id).set("interface", a.interface).opt("comment", a.comment).flag("disabled", a.disabled).opt("mtu", a.mtu).opt("forced-mac-address", a.forced_mac_address).flag("use-service-tag", a.use_service_tag).raw(a.arp !== "enabled" ? `arp=${a.arp}` : null).opt("arp-timeout", a.arp_timeout).opt("loop-protect", a.loop_protect).opt("loop-protect-disable-time", a.loop_protect_disable_time).opt("loop-protect-send-interval", a.loop_protect_send_interval).build();
|
|
60203
60291
|
const result = await executeMikrotikCommand2(cmd, ctx);
|
|
60204
60292
|
if (looksLikeError(result))
|
|
60205
60293
|
return `Failed to create VLAN interface: ${result}`;
|
|
@@ -60264,6 +60352,7 @@ ${result}`;
|
|
|
60264
60352
|
comment: string().optional(),
|
|
60265
60353
|
disabled: boolean().optional(),
|
|
60266
60354
|
mtu: number().int().optional(),
|
|
60355
|
+
forced_mac_address: string().optional().describe("RouterOS 7.25+ forced VLAN interface MAC address"),
|
|
60267
60356
|
use_service_tag: boolean().optional(),
|
|
60268
60357
|
arp: ArpMode2.optional(),
|
|
60269
60358
|
arp_timeout: string().optional(),
|
|
@@ -60273,7 +60362,7 @@ ${result}`;
|
|
|
60273
60362
|
},
|
|
60274
60363
|
async handler(a, ctx) {
|
|
60275
60364
|
ctx.info(`Updating VLAN interface: name=${a.name}`);
|
|
60276
|
-
const cmd = new Cmd(`/interface vlan set [find name="${a.name}"]`).opt("name", a.new_name).opt("vlan-id", a.vlan_id).opt("interface", a.interface).opt("comment", a.comment).bool("disabled", a.disabled).opt("mtu", a.mtu).bool("use-service-tag", a.use_service_tag).opt("arp", a.arp).opt("arp-timeout", a.arp_timeout).opt("loop-protect", a.loop_protect).opt("loop-protect-disable-time", a.loop_protect_disable_time).opt("loop-protect-send-interval", a.loop_protect_send_interval).build();
|
|
60365
|
+
const cmd = new Cmd(`/interface vlan set [find name="${a.name}"]`).opt("name", a.new_name).opt("vlan-id", a.vlan_id).opt("interface", a.interface).opt("comment", a.comment).bool("disabled", a.disabled).opt("mtu", a.mtu).opt("forced-mac-address", a.forced_mac_address).bool("use-service-tag", a.use_service_tag).opt("arp", a.arp).opt("arp-timeout", a.arp_timeout).opt("loop-protect", a.loop_protect).opt("loop-protect-disable-time", a.loop_protect_disable_time).opt("loop-protect-send-interval", a.loop_protect_send_interval).build();
|
|
60277
60366
|
if (!cmd.includes("=", cmd.indexOf("]")))
|
|
60278
60367
|
return "No updates specified.";
|
|
60279
60368
|
const result = await executeMikrotikCommand2(cmd, ctx);
|
|
@@ -60698,12 +60787,13 @@ ${details}`;
|
|
|
60698
60787
|
client_endpoint: string().optional().describe("server endpoint host[:port] written into the generated client config"),
|
|
60699
60788
|
client_keepalive: string().optional().describe('client persistent-keepalive for the generated config e.g. "25s"'),
|
|
60700
60789
|
client_listen_port: number().int().optional().describe("listen-port written into the generated client config"),
|
|
60790
|
+
client_mtu: number().int().min(576).max(65535).optional().describe("RouterOS 7.25+ MTU in generated client configuration"),
|
|
60701
60791
|
comment: string().optional(),
|
|
60702
60792
|
disabled: boolean().default(false)
|
|
60703
60793
|
},
|
|
60704
60794
|
async handler(a, ctx) {
|
|
60705
60795
|
ctx.info(`Adding WireGuard peer: interface=${a.interface}, public_key=${a.public_key.slice(0, 12)}...`);
|
|
60706
|
-
const cmd = new Cmd("/interface wireguard peers add").set("interface", a.interface).set("public-key", a.public_key).set("allowed-address", a.allowed_address).opt("endpoint-address", a.endpoint_address).opt("endpoint-port", a.endpoint_port).opt("preshared-key", a.preshared_key).opt("persistent-keepalive", a.persistent_keepalive).opt("name", a.name).opt("private-key", a.private_key).bool("responder", a.responder).opt("client-address", a.client_address).opt("client-dns", a.client_dns).opt("client-endpoint", a.client_endpoint).opt("client-keepalive", a.client_keepalive).opt("client-listen-port", a.client_listen_port).opt("comment", a.comment).flag("disabled", a.disabled).build();
|
|
60796
|
+
const cmd = new Cmd("/interface wireguard peers add").set("interface", a.interface).set("public-key", a.public_key).set("allowed-address", a.allowed_address).opt("endpoint-address", a.endpoint_address).opt("endpoint-port", a.endpoint_port).opt("preshared-key", a.preshared_key).opt("persistent-keepalive", a.persistent_keepalive).opt("name", a.name).opt("private-key", a.private_key).bool("responder", a.responder).opt("client-address", a.client_address).opt("client-dns", a.client_dns).opt("client-endpoint", a.client_endpoint).opt("client-keepalive", a.client_keepalive).opt("client-listen-port", a.client_listen_port).opt("client-mtu", a.client_mtu).opt("comment", a.comment).flag("disabled", a.disabled).build();
|
|
60707
60797
|
const result = await executeMikrotikCommand2(cmd, ctx);
|
|
60708
60798
|
if (looksLikeError(result))
|
|
60709
60799
|
return `Failed to add WireGuard peer: ${result}`;
|
|
@@ -60783,7 +60873,8 @@ ${result}`;
|
|
|
60783
60873
|
client_dns: string().optional().describe("DNS server(s) written into the generated client config"),
|
|
60784
60874
|
client_endpoint: string().optional().describe("server endpoint host[:port] written into the generated client config"),
|
|
60785
60875
|
client_keepalive: string().optional().describe('client persistent-keepalive for the generated config e.g. "25s"'),
|
|
60786
|
-
client_listen_port: number().int().optional().describe("listen
|
|
60876
|
+
client_listen_port: union([number().int(), literal("")]).optional().describe("Client listen port; empty string unsets it on RouterOS 7.25+"),
|
|
60877
|
+
client_mtu: number().int().min(576).max(65535).optional().describe("RouterOS 7.25+ MTU in generated client configuration"),
|
|
60787
60878
|
comment: string().optional(),
|
|
60788
60879
|
disabled: boolean().optional()
|
|
60789
60880
|
},
|
|
@@ -60793,7 +60884,7 @@ ${result}`;
|
|
|
60793
60884
|
if (!id)
|
|
60794
60885
|
return peerNotFound(a.peer_id);
|
|
60795
60886
|
const base = `/interface wireguard peers set ${id}`;
|
|
60796
|
-
const cmd = new Cmd(base).raw(a.public_key !== undefined ? `public-key=${quoteValue(a.public_key)}` : null).raw(a.allowed_address !== undefined ? `allowed-address=${quoteValue(a.allowed_address)}` : null).raw(a.endpoint_address !== undefined ? a.endpoint_address === "" ? "!endpoint-address" : `endpoint-address=${quoteValue(a.endpoint_address)}` : null).opt("endpoint-port", a.endpoint_port).raw(a.preshared_key !== undefined ? a.preshared_key === "" ? "!preshared-key" : `preshared-key=${quoteValue(a.preshared_key)}` : null).raw(a.persistent_keepalive !== undefined ? `persistent-keepalive=${a.persistent_keepalive}` : null).opt("name", a.name).opt("private-key", a.private_key).bool("responder", a.responder).raw(a.client_address !== undefined ? a.client_address === "" ? "!client-address" : `client-address=${quoteValue(a.client_address)}` : null).raw(a.client_dns !== undefined ? a.client_dns === "" ? "!client-dns" : `client-dns=${quoteValue(a.client_dns)}` : null).raw(a.client_endpoint !== undefined ? a.client_endpoint === "" ? "!client-endpoint" : `client-endpoint=${quoteValue(a.client_endpoint)}` : null).opt("client-keepalive", a.client_keepalive).opt("client-listen-port", a.client_listen_port).raw(a.comment !== undefined ? `comment=${quoteValue(a.comment)}` : null).bool("disabled", a.disabled).build();
|
|
60887
|
+
const cmd = new Cmd(base).raw(a.public_key !== undefined ? `public-key=${quoteValue(a.public_key)}` : null).raw(a.allowed_address !== undefined ? `allowed-address=${quoteValue(a.allowed_address)}` : null).raw(a.endpoint_address !== undefined ? a.endpoint_address === "" ? "!endpoint-address" : `endpoint-address=${quoteValue(a.endpoint_address)}` : null).opt("endpoint-port", a.endpoint_port).raw(a.preshared_key !== undefined ? a.preshared_key === "" ? "!preshared-key" : `preshared-key=${quoteValue(a.preshared_key)}` : null).raw(a.persistent_keepalive !== undefined ? `persistent-keepalive=${a.persistent_keepalive}` : null).opt("name", a.name).opt("private-key", a.private_key).bool("responder", a.responder).raw(a.client_address !== undefined ? a.client_address === "" ? "!client-address" : `client-address=${quoteValue(a.client_address)}` : null).raw(a.client_dns !== undefined ? a.client_dns === "" ? "!client-dns" : `client-dns=${quoteValue(a.client_dns)}` : null).raw(a.client_endpoint !== undefined ? a.client_endpoint === "" ? "!client-endpoint" : `client-endpoint=${quoteValue(a.client_endpoint)}` : null).opt("client-keepalive", a.client_keepalive).raw(a.client_listen_port === "" ? "!client-listen-port" : null).opt("client-listen-port", a.client_listen_port === "" ? undefined : a.client_listen_port).opt("client-mtu", a.client_mtu).raw(a.comment !== undefined ? `comment=${quoteValue(a.comment)}` : null).bool("disabled", a.disabled).build();
|
|
60797
60888
|
if (cmd === base)
|
|
60798
60889
|
return "No updates specified.";
|
|
60799
60890
|
const result = await executeMikrotikCommand2(cmd, ctx);
|