wpa: repeat rsne setup after deassociation (roamng between access points)
the "auth" ctl command only sets the rsne of the current selected access point. so on deassociation, we wait for the connection to the potentially new access point and then setup new rsne before processing eapol messages.
This commit is contained in:
parent
232dad19ad
commit
dda7b2c49f
1 changed files with 19 additions and 15 deletions
|
@ -57,6 +57,7 @@ Cipher ccmp = { "ccmp", 16 };
|
||||||
Cipher *peercipher;
|
Cipher *peercipher;
|
||||||
Cipher *groupcipher;
|
Cipher *groupcipher;
|
||||||
|
|
||||||
|
int background;
|
||||||
int prompt;
|
int prompt;
|
||||||
int debug;
|
int debug;
|
||||||
int fd, cfd;
|
int fd, cfd;
|
||||||
|
@ -544,6 +545,7 @@ void
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
uchar mac[Eaddrlen], buf[1024];
|
uchar mac[Eaddrlen], buf[1024];
|
||||||
|
static uchar brsne[258];
|
||||||
char addr[128];
|
char addr[128];
|
||||||
uchar *rsne;
|
uchar *rsne;
|
||||||
int rsnelen;
|
int rsnelen;
|
||||||
|
@ -614,13 +616,12 @@ main(int argc, char *argv[])
|
||||||
free(s);
|
free(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Connect:
|
||||||
/* bss scan might not be complete yet, so check for 10 seconds. */
|
/* bss scan might not be complete yet, so check for 10 seconds. */
|
||||||
for(try = 10; try >= 0 && !connected(); try--)
|
for(try = 10; (background || try >= 0) && !connected(); try--)
|
||||||
sleep(1000);
|
sleep(1000);
|
||||||
|
|
||||||
if(rsnelen <= 0){
|
if(rsnelen <= 0 || rsne == brsne){
|
||||||
static uchar brsne[258];
|
|
||||||
|
|
||||||
rsne = brsne;
|
rsne = brsne;
|
||||||
rsnelen = buildrsne(rsne);
|
rsnelen = buildrsne(rsne);
|
||||||
}
|
}
|
||||||
|
@ -644,18 +645,22 @@ main(int argc, char *argv[])
|
||||||
if(write(cfd, buf, n) != n)
|
if(write(cfd, buf, n) != n)
|
||||||
sysfatal("write auth: %r");
|
sysfatal("write auth: %r");
|
||||||
|
|
||||||
if(!debug){
|
if(!background){
|
||||||
switch(rfork(RFFDG|RFREND|RFPROC|RFNOWAIT)){
|
background = 1;
|
||||||
default:
|
if(!debug){
|
||||||
exits(nil);
|
switch(rfork(RFFDG|RFREND|RFPROC|RFNOWAIT)){
|
||||||
case -1:
|
default:
|
||||||
sysfatal("fork: %r");
|
exits(nil);
|
||||||
return;
|
case -1:
|
||||||
case 0:
|
sysfatal("fork: %r");
|
||||||
break;
|
return;
|
||||||
|
case 0:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lastrepc = 0ULL;
|
||||||
for(;;){
|
for(;;){
|
||||||
uchar smac[Eaddrlen], amac[Eaddrlen], snonce[Noncelen], anonce[Noncelen], *p, *e, *m;
|
uchar smac[Eaddrlen], amac[Eaddrlen], snonce[Noncelen], anonce[Noncelen], *p, *e, *m;
|
||||||
int proto, eapver, flags, vers, datalen;
|
int proto, eapver, flags, vers, datalen;
|
||||||
|
@ -668,8 +673,7 @@ main(int argc, char *argv[])
|
||||||
if(n == 0){
|
if(n == 0){
|
||||||
if(debug != 0)
|
if(debug != 0)
|
||||||
fprint(2, "got deassociation\n");
|
fprint(2, "got deassociation\n");
|
||||||
lastrepc = 0ULL;
|
goto Connect;
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
p = buf;
|
p = buf;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue