lmnet
lmnet is a statically-linked Linux network diagnostics CLI and LMScript host combining iputils ping and tracepath, iperf3, rtnetlink, procfs, DNS, and TCP scanning. It provides both direct JSON command-line introspection and strongly-typed _lmcode_ scripting via the net context and standard REST and CLI interfaces.
Quick reference
npm install -g @lmctl-ai/lmctl@latest
lmnet --version
lmnet --lmcode-schema
lmnet --lmcode-signatures
| Interface or flag | Signature or syntax | Purpose |
|---|---|---|
| CLI host bytecode | lmnet [--dry-run] --lmcode prog.dslb | Execute or dry-validate compiled LMScript bytecode against the embedded lmnet schema. |
| CLI schema and signatures | lmnet --lmcode-schema [--json] | --lmcode-signatures | Print human-readable schema summary, raw host schema JSON, or canonical signatures. |
| CLI ping, tracepath, iperf3 | lmnet ping HOST | lmnet tracepath HOST | lmnet iperf3 [opts] | Run the embedded upstream iputils ping, iputils tracepath, or iperf 3.22 throughput engines. |
| CLI DNS and route queries | lmnet dns HOST | lmnet dig NAME [TYPE] [@srv] | lmnet ifaddrs|link|route|rule|neigh | Emit structured JSON for DNS resolution, RFC 1035 queries, interfaces, 64-bit link stats, routes, rules, and ARP/NDP neighbors. |
| CLI sockets and counters | lmnet sockets [tcp|udp|unix] [--listen] [--summary] | lmnet counters | Dump /proc/net socket tables with process attribution, ss-style summaries, or flat kernel protocol counters as JSON. |
| CLI trace, scan, and pipe | lmnet trace HOST [ttl] | lmnet scan HOST [--ports SPEC] | lmnet pipe HOST PORT | Run UDP/ICMP traceroute, parallel TCP connect port scans, or binary-safe TCP stdio streaming bridges. |
| context net: Net (kernel) | net.interfaces() | net.links() | net.routes() | net.rules() | net.neighbors() | Inspect Linux interfaces, rtnetlink link statistics, routing tables, policy rules, and ARP/NDP neighbors in LMScript. |
| Net (DNS, sockets, TCP) | net.dns_lookup() | net.dns_query() | net.sockets() | net.scan() | net.tcp_connect() | Query DNS resolvers, inspect socket tables and protocol counters, scan TCP ports, or exchange raw TCP stream bytes. |
| Standard REST and CLI | RestGet..RestOptions, RestHandler, CliCommand, CliOption | Expose _lmcode_ functions as HTTP routes (:param) or stateless CLI flags and subcommands via rest_serve and rest_cli. |
p = _lmcode_ cli="lmnet" install="github:lmctl-ai/lmnet@latest";
let links = net.links();
assert(links.len() > 0);
let addrs = net.dns_lookup("localhost");
assert(addrs.len() > 0);
@"--dev"
fn opt_dev(x: RestExchange) -> void implements CliOption {
x.set("dev", x.query("dev"));
}
@"link-check"
fn cmd_link(x: RestExchange) -> void implements CliCommand {
let target = x.get("dev");
for (i in range(0, links.len())) {
if (links.at(i).name() == target) {
x.send(target + ":up=" + str(links.at(i).up()));
}
}
}
rest_config("session", "global");
assert_eq(rest_cli(str_split("--dev=lo link-check", " ")), "lo:up=true");
end _lmcode_
res = run_lmcode(p);
require(res.ok, json_stringify(res));
Documentation pages
- Skill — agent authoring rules, Linux CLI subcommands, privilege and timeout bounds, exit codes, and verification steps.
- Guide — static architecture, rtnetlink and procfs introspection, DNS/trace/scan/pipe engines, and standard REST and CLI interfaces.
- Reference — complete CLI subcommands, Net context types and methods, standard lmcode_std_v3 interfaces, and exit codes.