diff options
| author | Poul-Henning Kamp <phk@FreeBSD.org> | 2003-06-01 09:20:38 +0000 |
|---|---|---|
| committer | Poul-Henning Kamp <phk@FreeBSD.org> | 2003-06-01 09:20:38 +0000 |
| commit | 4df05d61bdf9e6aa80ecc3e437633929ad7079a3 (patch) | |
| tree | fbdaa5d2b1d3277d525b76c85114cdd68a2883c9 /sys/netinet/ip_encap.c | |
| parent | 58223589d5560a18d5532b8e74943edd8debcf5b (diff) | |
Notes
Diffstat (limited to 'sys/netinet/ip_encap.c')
| -rw-r--r-- | sys/netinet/ip_encap.c | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/sys/netinet/ip_encap.c b/sys/netinet/ip_encap.c index a547c6619b6c..edaadc46afec 100644 --- a/sys/netinet/ip_encap.c +++ b/sys/netinet/ip_encap.c @@ -279,6 +279,7 @@ encap6_input(mp, offp, proto) } #endif +/*lint -sem(encap_add, custodial(1)) */ static void encap_add(ep) struct encaptab *ep; @@ -302,21 +303,17 @@ encap_attach(af, proto, sp, sm, dp, dm, psw, arg) void *arg; { struct encaptab *ep; - int error; int s; s = splnet(); /* sanity check on args */ if (sp->sa_len > sizeof(ep->src) || dp->sa_len > sizeof(ep->dst)) { - error = EINVAL; goto fail; } if (sp->sa_len != dp->sa_len) { - error = EINVAL; goto fail; } if (af != sp->sa_family || af != dp->sa_family) { - error = EINVAL; goto fail; } @@ -335,13 +332,11 @@ encap_attach(af, proto, sp, sm, dp, dm, psw, arg) bcmp(&ep->dstmask, dm, dp->sa_len) != 0) continue; - error = EEXIST; goto fail; } ep = malloc(sizeof(*ep), M_NETADDR, M_NOWAIT); /*XXX*/ if (ep == NULL) { - error = ENOBUFS; goto fail; } bzero(ep, sizeof(*ep)); @@ -357,7 +352,6 @@ encap_attach(af, proto, sp, sm, dp, dm, psw, arg) encap_add(ep); - error = 0; splx(s); return ep; @@ -375,21 +369,16 @@ encap_attach_func(af, proto, func, psw, arg) void *arg; { struct encaptab *ep; - int error; int s; s = splnet(); /* sanity check on args */ - if (!func) { - error = EINVAL; + if (!func) goto fail; - } ep = malloc(sizeof(*ep), M_NETADDR, M_NOWAIT); /*XXX*/ - if (ep == NULL) { - error = ENOBUFS; + if (ep == NULL) goto fail; - } bzero(ep, sizeof(*ep)); ep->af = af; @@ -400,7 +389,6 @@ encap_attach_func(af, proto, func, psw, arg) encap_add(ep); - error = 0; splx(s); return ep; |
