aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet
diff options
context:
space:
mode:
authorBjoern A. Zeeb <bz@FreeBSD.org>2010-09-09 06:44:22 +0000
committerBjoern A. Zeeb <bz@FreeBSD.org>2010-09-09 06:44:22 +0000
commit8b2b9d0522b3b321e56bc7d8eb81dd65cd42099e (patch)
tree07b92f87d9576703b924057295e9c3631e882ae5 /sys/netinet
parent1b012d4f50084e714ec9999e3576208190ff79a9 (diff)
Notes
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/ip_input.c16
-rw-r--r--sys/netinet/ip_var.h4
2 files changed, 8 insertions, 12 deletions
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
index 0a366be3b45d..5d781de2448d 100644
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -1137,12 +1137,12 @@ ip_drain(void)
* in inetsw[], either statically or through pf_proto_register().
*/
int
-ipproto_register(u_char ipproto)
+ipproto_register(short ipproto)
{
struct protosw *pr;
/* Sanity checks. */
- if (ipproto == 0)
+ if (ipproto <= 0 || ipproto >= IPPROTO_MAX)
return (EPROTONOSUPPORT);
/*
@@ -1160,24 +1160,20 @@ ipproto_register(u_char ipproto)
pr < inetdomain.dom_protoswNPROTOSW; pr++) {
if (pr->pr_domain->dom_family == PF_INET &&
pr->pr_protocol && pr->pr_protocol == ipproto) {
- /* Be careful to only index valid IP protocols. */
- if (pr->pr_protocol < IPPROTO_MAX) {
- ip_protox[pr->pr_protocol] = pr - inetsw;
- return (0);
- } else
- return (EINVAL);
+ ip_protox[pr->pr_protocol] = pr - inetsw;
+ return (0);
}
}
return (EPROTONOSUPPORT);
}
int
-ipproto_unregister(u_char ipproto)
+ipproto_unregister(short ipproto)
{
struct protosw *pr;
/* Sanity checks. */
- if (ipproto == 0)
+ if (ipproto <= 0 || ipproto >= IPPROTO_MAX)
return (EPROTONOSUPPORT);
/* Check if the protocol was indeed registered. */
diff --git a/sys/netinet/ip_var.h b/sys/netinet/ip_var.h
index 436a4a0555ed..19e9b7e7669a 100644
--- a/sys/netinet/ip_var.h
+++ b/sys/netinet/ip_var.h
@@ -204,8 +204,8 @@ extern int
int ip_output(struct mbuf *,
struct mbuf *, struct route *, int, struct ip_moptions *,
struct inpcb *);
-int ipproto_register(u_char);
-int ipproto_unregister(u_char);
+int ipproto_register(short);
+int ipproto_unregister(short);
struct mbuf *
ip_reass(struct mbuf *);
struct in_ifaddr *