@usex/mikrotik-mcp 6.8.0 → 6.9.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/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/dist/shared/{cli-qszw8tv2.js → cli-0ckmf678.js} +1 -1
- package/dist/shared/{cli-ksq2qr7d.js → cli-7en5gay6.js} +1 -1
- package/dist/shared/{cli-4a4dxv04.js → cli-amd43kc5.js} +1 -1
- package/dist/shared/{cli-pan4hpjf.js → cli-fb8k4p45.js} +1 -1
- package/dist/shared/{cli-mh3kf1gx.js → cli-v5tym2a3.js} +91 -17
- package/dist/shared/{library-qwkp17zf.js → library-3hjxj4ph.js} +91 -17
- package/dist/shared/{library-g8fvds7b.js → library-5mbnzvye.js} +1 -1
- package/dist/shared/{library-qdh9kmg5.js → library-8fxp8mc8.js} +1 -1
- package/dist/shared/{library-r8m6ftrj.js → library-j1ptdg4x.js} +1 -1
- package/dist/shared/{library-5ejy1n1c.js → library-znv72s94.js} +1 -1
- package/package.json +1 -1
- 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
package/dist/cli.js
CHANGED
|
@@ -342,7 +342,7 @@ import {
|
|
|
342
342
|
allToolModules2,
|
|
343
343
|
ALWAYS_ON_MODULES2,
|
|
344
344
|
selectToolModules2
|
|
345
|
-
} from "./shared/cli-
|
|
345
|
+
} from "./shared/cli-v5tym2a3.js";
|
|
346
346
|
|
|
347
347
|
// node_modules/ajv/dist/compile/codegen/code.js
|
|
348
348
|
var require_code = __commonJS(function(exports) {
|
package/dist/index.js
CHANGED
|
@@ -70,7 +70,7 @@ import {
|
|
|
70
70
|
updateSummaryLine,
|
|
71
71
|
allToolModules2,
|
|
72
72
|
selectToolModules2
|
|
73
|
-
} from "./shared/library-
|
|
73
|
+
} from "./shared/library-3hjxj4ph.js";
|
|
74
74
|
|
|
75
75
|
// node_modules/ajv/dist/compile/codegen/code.js
|
|
76
76
|
var require_code = __commonJS(function(exports) {
|
|
@@ -16688,13 +16688,13 @@ async function undoMigration(id, confirm, selected) {
|
|
|
16688
16688
|
throw new Error("Undo lost Safe Mode or exceeded its time budget.");
|
|
16689
16689
|
await checkedRead(item.undo, createContext(undefined, device));
|
|
16690
16690
|
}
|
|
16691
|
-
const beforeTarget = (await import("./cli-
|
|
16692
|
-
const db = await beforeTarget((await import("./cli-
|
|
16691
|
+
const beforeTarget = (await import("./cli-fb8k4p45.js")).openSnapshotStore;
|
|
16692
|
+
const db = await beforeTarget((await import("./cli-0ckmf678.js")).DEFAULT_SNAPSHOT_DB);
|
|
16693
16693
|
try {
|
|
16694
16694
|
const original = db.get(p.snapshots.target);
|
|
16695
16695
|
if (!original)
|
|
16696
16696
|
throw new Error("Original target snapshot unavailable.");
|
|
16697
|
-
const { normalizeExport } = await import("./cli-
|
|
16697
|
+
const { normalizeExport } = await import("./cli-amd43kc5.js");
|
|
16698
16698
|
if (normalizeExport((await migrationInventory(device)).export) !== normalizeExport(original.body))
|
|
16699
16699
|
throw new Error("Target differs from its backup. Undo verification failed.");
|
|
16700
16700
|
} finally {
|
|
@@ -24193,6 +24193,11 @@ var bridgeTools = [
|
|
|
24193
24193
|
frame_types: FrameTypes.optional().describe("Default accepted frame types for ports"),
|
|
24194
24194
|
ingress_filtering: boolean().optional().describe("Default ingress VLAN filtering for ports"),
|
|
24195
24195
|
dhcp_snooping: boolean().optional().describe("Enable DHCP snooping"),
|
|
24196
|
+
arp_inspection: boolean().optional().describe("RouterOS 7.25+ validate ARP against DHCP snooping bindings"),
|
|
24197
|
+
ip_source_guard: boolean().optional().describe("RouterOS 7.25+ validate IPv4 source against DHCP snooping bindings"),
|
|
24198
|
+
mlag_init_delay: string().optional().describe("RouterOS 7.25+ MLAG LACP initialization delay"),
|
|
24199
|
+
mlag_lacp_fallback: boolean().optional().describe("RouterOS 7.25+ MLAG LACP fallback after peer loss"),
|
|
24200
|
+
confirm_security_disruption: literal(true).optional().describe("Required when enabling ARP inspection or IP source guard; DHCP bindings may be cleared and traffic interrupted"),
|
|
24196
24201
|
igmp_snooping: boolean().optional().describe("Enable IGMP/MLD snooping"),
|
|
24197
24202
|
fast_forward: boolean().optional().describe("Enable Fast Forward optimization"),
|
|
24198
24203
|
mvrp: boolean().optional().describe("Enable Multiple VLAN Registration Protocol"),
|
|
@@ -24201,8 +24206,10 @@ var bridgeTools = [
|
|
|
24201
24206
|
transmit_hold_count: number().int().optional().describe("STP transmit hold count")
|
|
24202
24207
|
},
|
|
24203
24208
|
async handler(a, ctx) {
|
|
24209
|
+
if ((a.arp_inspection || a.ip_source_guard) && !a.confirm_security_disruption)
|
|
24210
|
+
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.";
|
|
24204
24211
|
ctx.info(`Creating bridge: name=${a.name}, vlan_filtering=${a.vlan_filtering}`);
|
|
24205
|
-
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();
|
|
24212
|
+
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();
|
|
24206
24213
|
const result = await executeMikrotikCommand(cmd, ctx);
|
|
24207
24214
|
if (looksLikeError(result))
|
|
24208
24215
|
return `Failed to create bridge: ${result}`;
|
|
@@ -24269,6 +24276,11 @@ ${result}`;
|
|
|
24269
24276
|
frame_types: FrameTypes.optional().describe("Default accepted frame types for ports"),
|
|
24270
24277
|
ingress_filtering: boolean().optional().describe("Default ingress VLAN filtering for ports"),
|
|
24271
24278
|
dhcp_snooping: boolean().optional().describe("Enable DHCP snooping"),
|
|
24279
|
+
arp_inspection: boolean().optional().describe("RouterOS 7.25+ validate ARP against DHCP snooping bindings"),
|
|
24280
|
+
ip_source_guard: boolean().optional().describe("RouterOS 7.25+ validate IPv4 source against DHCP snooping bindings"),
|
|
24281
|
+
mlag_init_delay: string().optional().describe("RouterOS 7.25+ MLAG LACP initialization delay"),
|
|
24282
|
+
mlag_lacp_fallback: boolean().optional().describe("RouterOS 7.25+ MLAG LACP fallback after peer loss"),
|
|
24283
|
+
confirm_security_disruption: literal(true).optional().describe("Required when enabling ARP inspection or IP source guard; DHCP bindings may be cleared and traffic interrupted"),
|
|
24272
24284
|
igmp_snooping: boolean().optional().describe("Enable IGMP/MLD snooping"),
|
|
24273
24285
|
fast_forward: boolean().optional().describe("Enable Fast Forward optimization"),
|
|
24274
24286
|
mvrp: boolean().optional().describe("Enable Multiple VLAN Registration Protocol"),
|
|
@@ -24277,15 +24289,17 @@ ${result}`;
|
|
|
24277
24289
|
transmit_hold_count: number().int().optional().describe("STP transmit hold count")
|
|
24278
24290
|
},
|
|
24279
24291
|
async handler(a, ctx) {
|
|
24292
|
+
if ((a.arp_inspection || a.ip_source_guard) && !a.confirm_security_disruption)
|
|
24293
|
+
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.";
|
|
24280
24294
|
ctx.info(`Updating bridge: name=${a.name}`);
|
|
24281
|
-
const cmd = new Cmd(`/interface bridge set [find name
|
|
24295
|
+
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();
|
|
24282
24296
|
if (!cmd.includes("=", cmd.indexOf("]")))
|
|
24283
24297
|
return "No updates specified.";
|
|
24284
24298
|
const result = await executeMikrotikCommand(cmd, ctx);
|
|
24285
24299
|
if (looksLikeError(result))
|
|
24286
24300
|
return `Failed to update bridge: ${result}`;
|
|
24287
24301
|
const target = a.new_name ?? a.name;
|
|
24288
|
-
const details = await executeMikrotikCommand(
|
|
24302
|
+
const details = await executeMikrotikCommand(new Cmd("/interface bridge print detail where").set("name", target).build(), ctx);
|
|
24289
24303
|
return `Bridge updated successfully:
|
|
24290
24304
|
|
|
24291
24305
|
${details}`;
|
|
@@ -24335,6 +24349,7 @@ ${details}`;
|
|
|
24335
24349
|
restricted_role: boolean().optional().describe("Exclude port from becoming the root port"),
|
|
24336
24350
|
restricted_tcn: boolean().optional().describe("Block topology change notifications from this port"),
|
|
24337
24351
|
trusted: boolean().optional().describe("Trust DHCP server replies on this port (DHCP snooping)"),
|
|
24352
|
+
trusted_arp: boolean().optional().describe("RouterOS 7.25+ exempt this port from ARP inspection"),
|
|
24338
24353
|
multicast_router: MulticastRouter.optional().describe("IGMP-snooping multicast router state"),
|
|
24339
24354
|
fast_leave: boolean().optional().describe("IGMP-snooping fast leave"),
|
|
24340
24355
|
unknown_unicast_flood: boolean().optional().describe("Flood unknown-unicast frames to this port"),
|
|
@@ -24343,7 +24358,7 @@ ${details}`;
|
|
|
24343
24358
|
},
|
|
24344
24359
|
async handler(a, ctx) {
|
|
24345
24360
|
ctx.info(`Adding bridge port: bridge=${a.bridge}, interface=${a.interface}`);
|
|
24346
|
-
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();
|
|
24361
|
+
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();
|
|
24347
24362
|
const result = await executeMikrotikCommand(cmd, ctx);
|
|
24348
24363
|
if (looksLikeError(result))
|
|
24349
24364
|
return `Failed to add bridge port: ${result}`;
|
|
@@ -26986,6 +27001,7 @@ var dhcpTools = [
|
|
|
26986
27001
|
delay_threshold: string().optional(),
|
|
26987
27002
|
add_arp: boolean().optional().describe("Add dynamic ARP entry for each lease (use with reply-only ARP on the interface)"),
|
|
26988
27003
|
always_broadcast: boolean().optional().describe("Always send replies as broadcast"),
|
|
27004
|
+
ipv6_only_preferred: boolean().optional().describe("RouterOS 7.25+ advertise DHCP option 108 for IPv6-only preferred clients"),
|
|
26989
27005
|
bootp_support: _enum(["none", "static", "dynamic"]).optional().describe("Which BOOTP requests to answer"),
|
|
26990
27006
|
conflict_detection: boolean().optional().describe("Ping/ARP-probe an address before offering it to detect conflicts"),
|
|
26991
27007
|
use_radius: _enum(["yes", "no", "accounting"]).optional().describe("Use RADIUS for leases (accounting = RADIUS accounting only)"),
|
|
@@ -26996,7 +27012,7 @@ var dhcpTools = [
|
|
|
26996
27012
|
},
|
|
26997
27013
|
async handler(a, ctx) {
|
|
26998
27014
|
ctx.info(`Creating DHCP server: name=${a.name}, interface=${a.interface}`);
|
|
26999
|
-
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();
|
|
27015
|
+
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();
|
|
27000
27016
|
const result = await executeMikrotikCommand(cmd, ctx);
|
|
27001
27017
|
if (looksLikeError(result))
|
|
27002
27018
|
return `Failed to create DHCP server: ${result}`;
|
|
@@ -28731,7 +28747,7 @@ var cache3 = null;
|
|
|
28731
28747
|
async function gateway() {
|
|
28732
28748
|
if (cache3)
|
|
28733
28749
|
return cache3;
|
|
28734
|
-
const { moduleCatalog } = await import("./cli-
|
|
28750
|
+
const { moduleCatalog } = await import("./cli-7en5gay6.js");
|
|
28735
28751
|
const forIndex = [];
|
|
28736
28752
|
const byName = new Map;
|
|
28737
28753
|
for (const mod of moduleCatalog) {
|
|
@@ -29453,12 +29469,15 @@ var dot1xServerTools = [
|
|
|
29453
29469
|
reject_vlan_id: string().optional().describe("VLAN id or 'none'"),
|
|
29454
29470
|
server_fail_vlan_id: string().optional().describe("VLAN id or 'none'"),
|
|
29455
29471
|
reauth_timeout: string().optional().describe("Re-auth period or 'none'"),
|
|
29472
|
+
reauth_period: string().optional().describe("RouterOS 7.25+ re-authentication period"),
|
|
29456
29473
|
comment: string().optional(),
|
|
29457
29474
|
disabled: boolean().default(false)
|
|
29458
29475
|
},
|
|
29459
29476
|
async handler(a, ctx) {
|
|
29477
|
+
if (a.reauth_period !== undefined && a.reauth_timeout !== undefined)
|
|
29478
|
+
return "Specify either reauth_period (RouterOS 7.25+) or reauth_timeout (older RouterOS), not both.";
|
|
29460
29479
|
ctx.info(`Adding dot1x server: interface=${a.interface}`);
|
|
29461
|
-
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();
|
|
29480
|
+
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();
|
|
29462
29481
|
const result = await executeMikrotikCommand(cmd, ctx);
|
|
29463
29482
|
if (looksLikeError(result))
|
|
29464
29483
|
return `Failed to add dot1x server: ${result}`;
|
|
@@ -29524,14 +29543,18 @@ ${result}`;
|
|
|
29524
29543
|
reject_vlan_id: string().optional(),
|
|
29525
29544
|
server_fail_vlan_id: string().optional(),
|
|
29526
29545
|
reauth_timeout: string().optional(),
|
|
29546
|
+
reauth_period: string().optional().describe("RouterOS 7.25+ re-authentication period"),
|
|
29527
29547
|
comment: string().optional(),
|
|
29528
29548
|
disabled: boolean().optional()
|
|
29529
29549
|
},
|
|
29530
29550
|
async handler(a, ctx) {
|
|
29551
|
+
if (a.reauth_period !== undefined && a.reauth_timeout !== undefined)
|
|
29552
|
+
return "Specify either reauth_period (RouterOS 7.25+) or reauth_timeout (older RouterOS), not both.";
|
|
29531
29553
|
ctx.info(`Updating dot1x server: server_id=${a.server_id}`);
|
|
29532
29554
|
const selector = a.server_id.startsWith("*") ? `.id="${a.server_id}"` : `interface="${a.server_id}"`;
|
|
29533
29555
|
const base = `/interface dot1x server set [find ${selector}]`;
|
|
29534
29556
|
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);
|
|
29557
|
+
cmd.opt("reauth-period", a.reauth_period);
|
|
29535
29558
|
if (a.comment !== undefined)
|
|
29536
29559
|
cmd.raw(`comment=${quoteValue(a.comment)}`);
|
|
29537
29560
|
if (a.disabled !== undefined)
|
|
@@ -36208,6 +36231,8 @@ var ipv6DhcpServerTools = [
|
|
|
36208
36231
|
lease_time: string().default("3d").describe("Lease duration e.g. '1d', '12h', '30m'"),
|
|
36209
36232
|
binding_script: string().optional(),
|
|
36210
36233
|
rapid_commit: boolean().optional(),
|
|
36234
|
+
add_dns_entries: boolean().optional().describe("RouterOS 7.25+ create AAAA DNS entries for client FQDNs"),
|
|
36235
|
+
add_dns_entries_suffix: string().optional().describe("Suffix for dynamically created DHCPv6 DNS entries"),
|
|
36211
36236
|
preference: number().int().min(0).max(255).optional(),
|
|
36212
36237
|
route_distance: number().int().optional(),
|
|
36213
36238
|
use_radius: boolean().optional().describe("Authenticate clients via RADIUS"),
|
|
@@ -36219,7 +36244,7 @@ var ipv6DhcpServerTools = [
|
|
|
36219
36244
|
},
|
|
36220
36245
|
async handler(a, ctx) {
|
|
36221
36246
|
ctx.info(`Creating DHCPv6 server: name=${a.name}, interface=${a.interface}`);
|
|
36222
|
-
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();
|
|
36247
|
+
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();
|
|
36223
36248
|
const result = await executeMikrotikCommand(cmd, ctx);
|
|
36224
36249
|
if (looksLikeError(result))
|
|
36225
36250
|
return `Failed to create DHCPv6 server: ${result}`;
|
|
@@ -49279,6 +49304,51 @@ ${result}`;
|
|
|
49279
49304
|
// src/tools/routing-bgp.ts
|
|
49280
49305
|
var UNSUPPORTED2 = "BGP is not available on this device (requires RouterOS v7 with the routing package).";
|
|
49281
49306
|
var routingBgpTools = [
|
|
49307
|
+
defineTool({
|
|
49308
|
+
name: "list_bgp_instances",
|
|
49309
|
+
title: "List BGP Instances",
|
|
49310
|
+
annotations: READ,
|
|
49311
|
+
description: "Read BGP instances and their best-path selection settings, including RouterOS 7.25+ always-compare-med. Use before changing an instance.",
|
|
49312
|
+
async handler(_a, ctx) {
|
|
49313
|
+
const result = await executeMikrotikCommand("/routing bgp instance print detail", ctx);
|
|
49314
|
+
if (commandUnsupported(result))
|
|
49315
|
+
return UNSUPPORTED2;
|
|
49316
|
+
return isEmpty(result) ? "No BGP instances found." : `BGP INSTANCES:
|
|
49317
|
+
|
|
49318
|
+
${result}`;
|
|
49319
|
+
}
|
|
49320
|
+
}),
|
|
49321
|
+
defineTool({
|
|
49322
|
+
name: "update_bgp_instance_med_comparison",
|
|
49323
|
+
title: "Set BGP Instance MED Comparison",
|
|
49324
|
+
annotations: WRITE_IDEMPOTENT,
|
|
49325
|
+
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.",
|
|
49326
|
+
inputSchema: {
|
|
49327
|
+
name: string().min(1).describe("Exact BGP instance name"),
|
|
49328
|
+
always_compare_med: boolean(),
|
|
49329
|
+
confirm_routing_change: literal(true).describe("Operator approved the best-path behavior change")
|
|
49330
|
+
},
|
|
49331
|
+
async handler(a, ctx) {
|
|
49332
|
+
const selector = new Cmd("/routing bgp instance print count-only where").set("name", a.name).build();
|
|
49333
|
+
const count = await executeMikrotikCommand(selector, ctx);
|
|
49334
|
+
if (commandUnsupported(count))
|
|
49335
|
+
return UNSUPPORTED2;
|
|
49336
|
+
if (looksLikeError(count))
|
|
49337
|
+
return `Failed to inspect BGP instance: ${count}`;
|
|
49338
|
+
if (isEmpty(count) || count.trim() === "0")
|
|
49339
|
+
return `BGP instance '${a.name}' not found.`;
|
|
49340
|
+
const cmd = new Cmd(`/routing bgp instance set [find name=${quoteValue(a.name)}]`).bool("always-compare-med", a.always_compare_med).build();
|
|
49341
|
+
const result = await executeMikrotikCommand(cmd, ctx);
|
|
49342
|
+
if (looksLikeError(result))
|
|
49343
|
+
return `Failed to update BGP instance: ${result}`;
|
|
49344
|
+
const details = await executeMikrotikCommand(new Cmd("/routing bgp instance print detail where").set("name", a.name).build(), ctx);
|
|
49345
|
+
if (looksLikeError(details) || isEmpty(details))
|
|
49346
|
+
return `BGP instance update was sent, but read-back failed: ${details || "no details returned"}`;
|
|
49347
|
+
return `BGP instance '${a.name}' MED comparison updated:
|
|
49348
|
+
|
|
49349
|
+
${details}`;
|
|
49350
|
+
}
|
|
49351
|
+
}),
|
|
49282
49352
|
defineTool({
|
|
49283
49353
|
name: "list_bgp_connections",
|
|
49284
49354
|
title: "List BGP Connections",
|
|
@@ -54336,7 +54406,7 @@ var riskByTool = null;
|
|
|
54336
54406
|
async function riskIndex() {
|
|
54337
54407
|
if (riskByTool)
|
|
54338
54408
|
return riskByTool;
|
|
54339
|
-
const { moduleCatalog } = await import("./cli-
|
|
54409
|
+
const { moduleCatalog } = await import("./cli-7en5gay6.js");
|
|
54340
54410
|
const index = new Map;
|
|
54341
54411
|
for (const mod of moduleCatalog) {
|
|
54342
54412
|
for (const tool of mod.tools)
|
|
@@ -61742,6 +61812,7 @@ var vlanTools = [
|
|
|
61742
61812
|
comment: string().optional(),
|
|
61743
61813
|
disabled: boolean().default(false),
|
|
61744
61814
|
mtu: number().int().optional(),
|
|
61815
|
+
forced_mac_address: string().optional().describe("RouterOS 7.25+ forced VLAN interface MAC address"),
|
|
61745
61816
|
use_service_tag: boolean().default(false).describe("Use 802.1ad service tag (QinQ)"),
|
|
61746
61817
|
arp: ArpMode2.default("enabled"),
|
|
61747
61818
|
arp_timeout: string().optional(),
|
|
@@ -61751,7 +61822,7 @@ var vlanTools = [
|
|
|
61751
61822
|
},
|
|
61752
61823
|
async handler(a, ctx) {
|
|
61753
61824
|
ctx.info(`Creating VLAN interface: name=${a.name}, vlan_id=${a.vlan_id}, interface=${a.interface}`);
|
|
61754
|
-
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();
|
|
61825
|
+
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();
|
|
61755
61826
|
const result = await executeMikrotikCommand(cmd, ctx);
|
|
61756
61827
|
if (looksLikeError(result))
|
|
61757
61828
|
return `Failed to create VLAN interface: ${result}`;
|
|
@@ -61816,6 +61887,7 @@ ${result}`;
|
|
|
61816
61887
|
comment: string().optional(),
|
|
61817
61888
|
disabled: boolean().optional(),
|
|
61818
61889
|
mtu: number().int().optional(),
|
|
61890
|
+
forced_mac_address: string().optional().describe("RouterOS 7.25+ forced VLAN interface MAC address"),
|
|
61819
61891
|
use_service_tag: boolean().optional(),
|
|
61820
61892
|
arp: ArpMode2.optional(),
|
|
61821
61893
|
arp_timeout: string().optional(),
|
|
@@ -61825,7 +61897,7 @@ ${result}`;
|
|
|
61825
61897
|
},
|
|
61826
61898
|
async handler(a, ctx) {
|
|
61827
61899
|
ctx.info(`Updating VLAN interface: name=${a.name}`);
|
|
61828
|
-
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();
|
|
61900
|
+
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();
|
|
61829
61901
|
if (!cmd.includes("=", cmd.indexOf("]")))
|
|
61830
61902
|
return "No updates specified.";
|
|
61831
61903
|
const result = await executeMikrotikCommand(cmd, ctx);
|
|
@@ -62250,12 +62322,13 @@ ${details}`;
|
|
|
62250
62322
|
client_endpoint: string().optional().describe("server endpoint host[:port] written into the generated client config"),
|
|
62251
62323
|
client_keepalive: string().optional().describe('client persistent-keepalive for the generated config e.g. "25s"'),
|
|
62252
62324
|
client_listen_port: number().int().optional().describe("listen-port written into the generated client config"),
|
|
62325
|
+
client_mtu: number().int().min(576).max(65535).optional().describe("RouterOS 7.25+ MTU in generated client configuration"),
|
|
62253
62326
|
comment: string().optional(),
|
|
62254
62327
|
disabled: boolean().default(false)
|
|
62255
62328
|
},
|
|
62256
62329
|
async handler(a, ctx) {
|
|
62257
62330
|
ctx.info(`Adding WireGuard peer: interface=${a.interface}, public_key=${a.public_key.slice(0, 12)}...`);
|
|
62258
|
-
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();
|
|
62331
|
+
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();
|
|
62259
62332
|
const result = await executeMikrotikCommand(cmd, ctx);
|
|
62260
62333
|
if (looksLikeError(result))
|
|
62261
62334
|
return `Failed to add WireGuard peer: ${result}`;
|
|
@@ -62335,7 +62408,8 @@ ${result}`;
|
|
|
62335
62408
|
client_dns: string().optional().describe("DNS server(s) written into the generated client config"),
|
|
62336
62409
|
client_endpoint: string().optional().describe("server endpoint host[:port] written into the generated client config"),
|
|
62337
62410
|
client_keepalive: string().optional().describe('client persistent-keepalive for the generated config e.g. "25s"'),
|
|
62338
|
-
client_listen_port: number().int().optional().describe("listen
|
|
62411
|
+
client_listen_port: union([number().int(), literal("")]).optional().describe("Client listen port; empty string unsets it on RouterOS 7.25+"),
|
|
62412
|
+
client_mtu: number().int().min(576).max(65535).optional().describe("RouterOS 7.25+ MTU in generated client configuration"),
|
|
62339
62413
|
comment: string().optional(),
|
|
62340
62414
|
disabled: boolean().optional()
|
|
62341
62415
|
},
|
|
@@ -62345,7 +62419,7 @@ ${result}`;
|
|
|
62345
62419
|
if (!id)
|
|
62346
62420
|
return peerNotFound(a.peer_id);
|
|
62347
62421
|
const base = `/interface wireguard peers set ${id}`;
|
|
62348
|
-
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();
|
|
62422
|
+
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();
|
|
62349
62423
|
if (cmd === base)
|
|
62350
62424
|
return "No updates specified.";
|
|
62351
62425
|
const result = await executeMikrotikCommand(cmd, ctx);
|