PERFORCE change 105375 for review
Paolo Pisati
piso at FreeBSD.org
Wed Aug 30 21:45:37 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=105375
Change 105375 by piso at piso_newluxor on 2006/08/30 21:45:28
Fix a forgotten rw_runlock() and try to be a bit more style
friendly.
Affected files ...
.. //depot/projects/soc2005/libalias/sys/netinet/ip_fw2.c#11 edit
Differences ...
==== //depot/projects/soc2005/libalias/sys/netinet/ip_fw2.c#11 (text+ko) ====
@@ -2120,7 +2120,7 @@
int sof_redir = sizeof(struct cfg_redir);
int sof_spool = sizeof(struct cfg_spool);
struct cfg_redir *r, *ser_r;
- struct cfg_spool *s, *ser_s;
+ struct cfg_spool *s, *ser_s;
int cnt, off, i;
char *panic_err;
@@ -2177,10 +2177,10 @@
break;
}
if (r->alink[0] == NULL) {
- panic_err = "LibAliasRedirect* returned NULL!!!\n";
+ panic_err = "LibAliasRedirect* returned NULL";
goto bad;
} else /* LSNAT handling. */
- for (i=0; i < r->spool_cnt; i++) {
+ for (i = 0; i < r->spool_cnt; i++) {
ser_s = (struct cfg_spool *)&buf[off];
s = malloc(sof_redir, M_IPFW, M_NOWAIT | M_ZERO);
if (s == NULL) {
@@ -4650,18 +4650,21 @@
bcopy(s, &data[off], sof_spool);
off += sof_spool;
} else
- break;
+ goto nospace;
}
} else
- break;
+ goto nospace;
}
} else
- break;
+ goto nospace;
}
NAT_RUNLOCK(&nat_chain_rwl);
-
error = sooptcopyout(sopt, data, NAT_BUF_LEN);
free(data, M_IPFW);
+ nospace:
+ NAT_RUNLOCK(&nat_chain_rwl);
+ printf("serialized data buffer not big enough: please increase NAT_BUF_LEN\n");
+ free(data, M_IPFW);
}
break;
@@ -4680,8 +4683,10 @@
cnt++;
size = cnt * (sof + sizeof(int));
data = realloc(data, size, M_IPFW, M_NOWAIT | M_ZERO);
- if (data == NULL)
+ if (data == NULL) {
+ NAT_RUNLOCK(&nat_chain_rwl);
return (ENOSPC);
+ }
bcopy(&ptr->id, &data[i], sizeof(int));
i += sizeof(int);
bcopy(ptr->lib->logDesc, &data[i], sof);
More information about the p4-projects
mailing list