git: 9front

Download patch

ref: 05acaf44679fbbe8fd91d7a08b8327ed57b4cfae
parent: ab841cbe6458b9a3665f6e8cb96509c81cfa14c4
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Jun 1 09:24:32 EDT 2025

devip: make dial(2) work for /net/ipifc

Dial(2) was not working as just cloning /net/ipifc/clone
gets you an unbound interface, and adding an address
requires the ipifc to be bound.

To fix: just bind a pkt interface if not already bound.

--- a/sys/src/9/ip/ipifc.c
+++ b/sys/src/9/ip/ipifc.c
@@ -790,6 +790,12 @@
 		ipifcdellifc(ifc, &ifc->lifc);
 	wunlock(ifc);
 
+	/* when using dial(1), need to bind first */
+	if(ifc->m == nil){
+		char *a[2] = { "bind", "pkt" };
+		ipifcbind(c, a, 2);
+	}
+
 	err = ipifcadd(ifc, argv, argc, 0, nil);
 	if(err != nil)
 		return err;
--