Deleted Added
full compact
if_faith.c (147256) if_faith.c (147611)
1/* $KAME: if_faith.c,v 1.23 2001/12/17 13:55:29 sumikawa Exp $ */
2
3/*-
4 * Copyright (c) 1982, 1986, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 14 unchanged lines hidden (view full) ---

23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 *
1/* $KAME: if_faith.c,v 1.23 2001/12/17 13:55:29 sumikawa Exp $ */
2
3/*-
4 * Copyright (c) 1982, 1986, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 14 unchanged lines hidden (view full) ---

23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 *
31 * $FreeBSD: head/sys/net/if_faith.c 147256 2005-06-10 16:49:24Z brooks $
31 * $FreeBSD: head/sys/net/if_faith.c 147611 2005-06-26 18:11:11Z dwmalone $
32 */
33/*
34 * derived from
35 * @(#)if_loop.c 8.1 (Berkeley) 6/10/93
36 * Id: if_loop.c,v 1.22 1996/06/19 16:24:10 wollman Exp
37 */
38
39/*

--- 142 unchanged lines hidden (view full) ---

182 /* Change to BROADCAST experimentaly to announce its prefix. */
183 ifp->if_flags = /* IFF_LOOPBACK */ IFF_BROADCAST | IFF_MULTICAST;
184 ifp->if_ioctl = faithioctl;
185 ifp->if_output = faithoutput;
186 ifp->if_hdrlen = 0;
187 ifp->if_addrlen = 0;
188 ifp->if_snd.ifq_maxlen = ifqmaxlen;
189 if_attach(ifp);
32 */
33/*
34 * derived from
35 * @(#)if_loop.c 8.1 (Berkeley) 6/10/93
36 * Id: if_loop.c,v 1.22 1996/06/19 16:24:10 wollman Exp
37 */
38
39/*

--- 142 unchanged lines hidden (view full) ---

182 /* Change to BROADCAST experimentaly to announce its prefix. */
183 ifp->if_flags = /* IFF_LOOPBACK */ IFF_BROADCAST | IFF_MULTICAST;
184 ifp->if_ioctl = faithioctl;
185 ifp->if_output = faithoutput;
186 ifp->if_hdrlen = 0;
187 ifp->if_addrlen = 0;
188 ifp->if_snd.ifq_maxlen = ifqmaxlen;
189 if_attach(ifp);
190 bpfattach(ifp, DLT_NULL, sizeof(u_int));
190 bpfattach(ifp, DLT_NULL, sizeof(u_int32_t));
191 mtx_lock(&faith_mtx);
192 LIST_INSERT_HEAD(&faith_softc_list, sc, sc_list);
193 mtx_unlock(&faith_mtx);
194 return (0);
195}
196
197static void
198faith_destroy(struct faith_softc *sc)

--- 21 unchanged lines hidden (view full) ---

220int
221faithoutput(ifp, m, dst, rt)
222 struct ifnet *ifp;
223 struct mbuf *m;
224 struct sockaddr *dst;
225 struct rtentry *rt;
226{
227 int isr;
191 mtx_lock(&faith_mtx);
192 LIST_INSERT_HEAD(&faith_softc_list, sc, sc_list);
193 mtx_unlock(&faith_mtx);
194 return (0);
195}
196
197static void
198faith_destroy(struct faith_softc *sc)

--- 21 unchanged lines hidden (view full) ---

220int
221faithoutput(ifp, m, dst, rt)
222 struct ifnet *ifp;
223 struct mbuf *m;
224 struct sockaddr *dst;
225 struct rtentry *rt;
226{
227 int isr;
228 u_int32_t af;
228
229 M_ASSERTPKTHDR(m);
230
229
230 M_ASSERTPKTHDR(m);
231
231 /* BPF write needs to be handled specially */
232 /* BPF writes need to be handled specially. */
232 if (dst->sa_family == AF_UNSPEC) {
233 if (dst->sa_family == AF_UNSPEC) {
233 dst->sa_family = *(mtod(m, int *));
234 m->m_len -= sizeof(int);
235 m->m_pkthdr.len -= sizeof(int);
236 m->m_data += sizeof(int);
234 bcopy(dst->sa_data, &af, sizeof(af));
235 dst->sa_family = af;
237 }
238
239 if (ifp->if_bpf) {
236 }
237
238 if (ifp->if_bpf) {
240 u_int32_t af = dst->sa_family;
239 af = dst->sa_family;
241 bpf_mtap2(ifp->if_bpf, &af, sizeof(af), m);
242 }
243
244 if (rt && rt->rt_flags & (RTF_REJECT|RTF_BLACKHOLE)) {
245 m_freem(m);
246 return (rt->rt_flags & RTF_BLACKHOLE ? 0 :
247 rt->rt_flags & RTF_HOST ? EHOSTUNREACH : ENETUNREACH);
248 }

--- 131 unchanged lines hidden ---
240 bpf_mtap2(ifp->if_bpf, &af, sizeof(af), m);
241 }
242
243 if (rt && rt->rt_flags & (RTF_REJECT|RTF_BLACKHOLE)) {
244 m_freem(m);
245 return (rt->rt_flags & RTF_BLACKHOLE ? 0 :
246 rt->rt_flags & RTF_HOST ? EHOSTUNREACH : ENETUNREACH);
247 }

--- 131 unchanged lines hidden ---