ref: 67f18dc14f0650e3e0689fba8ef4546a23f42773
parent: 4f9aed04b7101c81af6fd3f4af7ef60ef6894dbf
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun May 12 09:42:26 EDT 2024
ip/ipconfig: add "null" verb to bind nullmedium Example usage: ip/ipconfig null /dev/mordor 8.8.8.8 /128
--- a/sys/src/cmd/ip/ipconfig/ipconfig.h
+++ b/sys/src/cmd/ip/ipconfig/ipconfig.h
@@ -16,6 +16,7 @@
Vtorus,
Vtree,
Vpkt,
+ Vnull,
};
typedef struct Conf Conf;
--- a/sys/src/cmd/ip/ipconfig/main.c
+++ b/sys/src/cmd/ip/ipconfig/main.c
@@ -182,6 +182,7 @@
[Vtorus] "torus",
[Vtree] "tree",
[Vpkt] "pkt",
+ [Vnull] "null",
};
int i;
@@ -226,6 +227,7 @@
case Vppp:
case Vtorus:
case Vtree:
+ case Vnull:
conf.type = *argv++;
argc--;
if(argc > 0){@@ -236,8 +238,11 @@
break;
}
}
- if(conf.dev == nil)
+ if(conf.dev == nil){+ if(!isether())
+ sysfatal("no device specified for medium %s", conf.type);conf.dev = finddev(conf.mpoint, "ether", "/net/ether0");
+ }
/* get optional verb */
if (argc > 0){@@ -250,6 +255,7 @@
case Vtorus:
case Vtree:
case Vpkt:
+ case Vnull:
sysfatal("medium %s already specified", conf.type);case Vadd:
case Vdel:
--
⑨