ndb/cs: fix crash in ndbredorder due to ndbnew() not maintaining the ->line ring
we have to maintain the ->line chain for ndbreorder() to work, so add a little helper: ndbline() which replicates the ->entry chain and links the last tuple to the first; makeing the whole list into a single line.
This commit is contained in:
parent
bc4469e5d2
commit
8e53fe132e
1 changed files with 19 additions and 16 deletions
|
@ -1386,6 +1386,20 @@ isv4str(char *s)
|
||||||
return parseip(ip, s) != -1 && isv4(ip);
|
return parseip(ip, s) != -1 && isv4(ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Ndbtuple*
|
||||||
|
ndbline(Ndbtuple *t)
|
||||||
|
{
|
||||||
|
Ndbtuple *nt;
|
||||||
|
|
||||||
|
for(nt = t; nt != nil; nt = nt->entry){
|
||||||
|
if(nt->entry == nil)
|
||||||
|
nt->line = t;
|
||||||
|
else
|
||||||
|
nt->line = nt->entry;
|
||||||
|
}
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* lookup an ip destination
|
* lookup an ip destination
|
||||||
*/
|
*/
|
||||||
|
@ -1410,20 +1424,20 @@ iplookuphost(Network *np, char *host)
|
||||||
|
|
||||||
/* for dial strings with no host */
|
/* for dial strings with no host */
|
||||||
if(strcmp(host, "*") == 0)
|
if(strcmp(host, "*") == 0)
|
||||||
return ndbnew("ip", "*");
|
return ndbline(ndbnew("ip", "*"));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* hack till we go v6 :: = 0.0.0.0
|
* hack till we go v6 :: = 0.0.0.0
|
||||||
*/
|
*/
|
||||||
if(strcmp("::", host) == 0)
|
if(strcmp("::", host) == 0)
|
||||||
return ndbnew("ip", "*");
|
return ndbline(ndbnew("ip", "*"));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* just accept addresses
|
* just accept addresses
|
||||||
*/
|
*/
|
||||||
attr = ipattr(host);
|
attr = ipattr(host);
|
||||||
if(strcmp(attr, "ip") == 0)
|
if(strcmp(attr, "ip") == 0)
|
||||||
return ndbnew("ip", host);
|
return ndbline(ndbnew("ip", host));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* give the domain name server the first opportunity to
|
* give the domain name server the first opportunity to
|
||||||
|
@ -1627,14 +1641,8 @@ dnsip6lookup(char *mntpt, char *buf, Ndbtuple *t)
|
||||||
if (strcmp(tt->attr, "ipv6") == 0)
|
if (strcmp(tt->attr, "ipv6") == 0)
|
||||||
strcpy(tt->attr, "ip");
|
strcpy(tt->attr, "ip");
|
||||||
|
|
||||||
if (t == nil)
|
|
||||||
return t6;
|
|
||||||
|
|
||||||
/* append t6 list to t list */
|
/* append t6 list to t list */
|
||||||
for (tt = t; tt->entry != nil; tt = tt->entry)
|
return ndbconcatenate(t, t6);
|
||||||
;
|
|
||||||
tt->entry = t6;
|
|
||||||
return t;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1911,12 +1919,7 @@ ipinfoquery(Mfile *mf, char **list, int n)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* make it all one line */
|
/* make it all one line */
|
||||||
for(nt = t; nt != nil; nt = nt->entry){
|
t = ndbline(t);
|
||||||
if(nt->entry == nil)
|
|
||||||
nt->line = t;
|
|
||||||
else
|
|
||||||
nt->line = nt->entry;
|
|
||||||
}
|
|
||||||
|
|
||||||
qreply(mf, t);
|
qreply(mf, t);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue