/*
- * Copyright (c) 2000-2012 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2016 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
- *
+ *
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
- *
+ *
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
- *
+ *
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
- *
+ *
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/* $FreeBSD: src/sys/netinet/ip_encap.c,v 1.1.2.2 2001/07/03 11:01:46 ume Exp $ */
#include <netinet/ip.h>
#include <netinet/ip_var.h>
#include <netinet/ip_encap.h>
-#if MROUTING
-#include <netinet/ip_mroute.h>
-#endif /* MROUTING */
#if INET6
#include <netinet/ip6.h>
#if INET
void
-encap4_input(m, off)
- struct mbuf *m;
- int off;
+encap4_input(struct mbuf *m, int off)
{
int proto;
struct ip *ip;
return;
}
- /* for backward compatibility */
-# if MROUTING
-# define COMPATFUNC ipip_input
-# endif /*MROUTING*/
-
-#if COMPATFUNC
- if (proto == IPPROTO_IPV4) {
- COMPATFUNC(m, off);
- return;
- }
-#endif
-
/* last resort: inject to raw socket */
rip_input(m, off);
}
#endif
static void
-encap_add(ep)
- struct encaptab *ep;
+encap_add(struct encaptab *ep)
{
-
LIST_INSERT_HEAD(&encaptab, ep, chain);
}
* Return value will be necessary as input (cookie) for encap_detach().
*/
const struct encaptab *
-encap_attach(af, proto, sp, sm, dp, dm, psw, arg)
- int af;
- int proto;
- const struct sockaddr *sp, *sm;
- const struct sockaddr *dp, *dm;
- const struct protosw *psw;
- void *arg;
+encap_attach(int af, int proto, const struct sockaddr *sp,
+ const struct sockaddr *sm, const struct sockaddr *dp,
+ const struct sockaddr *dm, const struct protosw *psw, void *arg)
{
struct encaptab *ep;
int error;
goto fail;
}
- ep = _MALLOC(sizeof(*ep), M_NETADDR, M_WAITOK); /*XXX*/
+ ep = _MALLOC(sizeof(*ep), M_NETADDR, M_WAITOK | M_ZERO); /* XXX */
if (ep == NULL) {
error = ENOBUFS;
goto fail;
}
- bzero(ep, sizeof(*ep));
ep->af = af;
ep->proto = proto;
}
const struct encaptab *
-encap_attach_func(af, proto, func, psw, arg)
- int af;
- int proto;
- int (*func)(const struct mbuf *, int, int, void *);
- const struct protosw *psw;
- void *arg;
+encap_attach_func( int af, int proto,
+ int (*func)(const struct mbuf *, int, int, void *),
+ const struct protosw *psw, void *arg)
{
struct encaptab *ep;
int error;
goto fail;
}
- ep = _MALLOC(sizeof(*ep), M_NETADDR, M_WAITOK); /*XXX*/
+ ep = _MALLOC(sizeof(*ep), M_NETADDR, M_WAITOK | M_ZERO); /* XXX */
if (ep == NULL) {
error = ENOBUFS;
goto fail;
}
- bzero(ep, sizeof(*ep));
ep->af = af;
ep->proto = proto;
}
int
-encap_detach(cookie)
- const struct encaptab *cookie;
+encap_detach(const struct encaptab *cookie)
{
const struct encaptab *ep = cookie;
struct encaptab *p;
}
static int
-mask_match(ep, sp, dp)
- const struct encaptab *ep;
- const struct sockaddr *sp;
- const struct sockaddr *dp;
+mask_match(const struct encaptab *ep, const struct sockaddr *sp,
+ const struct sockaddr *dp)
{
struct sockaddr_storage s;
struct sockaddr_storage d;
}
void *
-encap_getarg(m)
- struct mbuf *m;
+encap_getarg(struct mbuf *m)
{
struct m_tag *tag;
struct encaptabtag *et;