changelog shortlog tags branches files raw gz bz2 help

Mercurial > hg > plan9front / changeset: devip: make sure ifc is bound in add6 ctl command

changeset 7230: 3a5ccd543798
parent 7229: a0387db0dcba
child 7231: 7c0cb11e474d
author: cinap_lenrek@felloff.net
date: Sat, 11 May 2019 14:54:10 +0200
files: sys/src/9/ip/ipifc.c
description: devip: make sure ifc is bound in add6 ctl command
     1.1--- a/sys/src/9/ip/ipifc.c
     1.2+++ b/sys/src/9/ip/ipifc.c
     1.3@@ -1576,13 +1576,14 @@ ipifcregisterproxy(Fs *f, Ipifc *ifc, uc
     1.4 }
     1.5 
     1.6 char*
     1.7-ipifcadd6(Ipifc *ifc, char**argv, int argc)
     1.8+ipifcadd6(Ipifc *ifc, char **argv, int argc)
     1.9 {
    1.10 	int plen = 64;
    1.11 	char addr[40], preflen[6];
    1.12 	char *params[3];
    1.13 	uchar prefix[IPaddrlen];
    1.14 	Iplifc lifc;
    1.15+	Medium *m;
    1.16 
    1.17 	lifc.onlink = 1;
    1.18 	lifc.autoflag = 1;
    1.19@@ -1616,9 +1617,10 @@ ipifcadd6(Ipifc *ifc, char**argv, int ar
    1.20 		return Ebadarg;
    1.21 
    1.22 	/* issue "add" ctl msg for v6 link-local addr and prefix len */
    1.23-	if(ifc->m->pref2addr == nil)
    1.24+	m = ifc->m;
    1.25+	if(m == nil || m->pref2addr == nil)
    1.26 		return Ebadarg;
    1.27-	(*ifc->m->pref2addr)(prefix, ifc->mac);	/* mac → v6 link-local addr */
    1.28+	(*m->pref2addr)(prefix, ifc->mac);	/* mac → v6 link-local addr */
    1.29 
    1.30 	sprint(addr, "%I", prefix);
    1.31 	sprint(preflen, "/%d", plen);