ref: 7186be0424ba65942a13b7706017c6ef4338f219
parent: 3a0d5f41a8253b4a3fbb6ae4b6ca77789fd6ae83
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sat May 11 10:54:10 EDT 2019
devip: make sure ifc is bound in add6 ctl command
--- a/sys/src/9/ip/ipifc.c
+++ b/sys/src/9/ip/ipifc.c
@@ -1576,7 +1576,7 @@
}
char*
-ipifcadd6(Ipifc *ifc, char**argv, int argc)
+ipifcadd6(Ipifc *ifc, char **argv, int argc)
{
int plen = 64;
char addr[40], preflen[6];
@@ -1583,6 +1583,7 @@
char *params[3];
uchar prefix[IPaddrlen];
Iplifc lifc;
+ Medium *m;
lifc.onlink = 1;
lifc.autoflag = 1;
@@ -1616,9 +1617,10 @@
return Ebadarg;
/* issue "add" ctl msg for v6 link-local addr and prefix len */
- if(ifc->m->pref2addr == nil)
+ m = ifc->m;
+ if(m == nil || m->pref2addr == nil)
return Ebadarg;
- (*ifc->m->pref2addr)(prefix, ifc->mac); /* mac → v6 link-local addr */
+ (*m->pref2addr)(prefix, ifc->mac); /* mac → v6 link-local addr */
sprint(addr, "%I", prefix);
sprint(preflen, "/%d", plen);