Deleted Added
full compact
if_arcsubr.c (106939) if_arcsubr.c (109623)
1/* $NetBSD: if_arcsubr.c,v 1.36 2001/06/14 05:44:23 itojun Exp $ */
1/* $NetBSD: if_arcsubr.c,v 1.36 2001/06/14 05:44:23 itojun Exp $ */
2/* $FreeBSD: head/sys/net/if_arcsubr.c 106939 2002-11-15 00:00:15Z sam $ */
2/* $FreeBSD: head/sys/net/if_arcsubr.c 109623 2003-01-21 08:56:16Z alfred $ */
3
4/*
5 * Copyright (c) 1994, 1995 Ignatios Souvatzis
6 * Copyright (c) 1982, 1989, 1993
7 * The Regents of the University of California. All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions

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

198 default:
199 if_printf(ifp, "can't handle af%d\n", dst->sa_family);
200 senderr(EAFNOSUPPORT);
201 }
202
203 if (mcopy)
204 (void) if_simloop(ifp, mcopy, dst->sa_family, 0);
205
3
4/*
5 * Copyright (c) 1994, 1995 Ignatios Souvatzis
6 * Copyright (c) 1982, 1989, 1993
7 * The Regents of the University of California. All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions

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

198 default:
199 if_printf(ifp, "can't handle af%d\n", dst->sa_family);
200 senderr(EAFNOSUPPORT);
201 }
202
203 if (mcopy)
204 (void) if_simloop(ifp, mcopy, dst->sa_family, 0);
205
206 M_PREPEND(m, ARC_HDRLEN, M_DONTWAIT);
206 M_PREPEND(m, ARC_HDRLEN, M_NOWAIT);
207 if (m == 0)
208 senderr(ENOBUFS);
209 ah = mtod(m, struct arc_header *);
210 ah->arc_type = atype;
211 ah->arc_dhost = adst;
212 ah->arc_shost = *IF_LLADDR(ifp);
213
214 BPF_MTAP(ifp, m);

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

287
288 m_adj(m, ARC_HDRLEN);
289 ac->curr_frag = m;
290 }
291
292 /* split out next fragment and return it */
293 if (ac->sflag < ac->fsflag) {
294 /* we CAN'T have short packets here */
207 if (m == 0)
208 senderr(ENOBUFS);
209 ah = mtod(m, struct arc_header *);
210 ah->arc_type = atype;
211 ah->arc_dhost = adst;
212 ah->arc_shost = *IF_LLADDR(ifp);
213
214 BPF_MTAP(ifp, m);

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

287
288 m_adj(m, ARC_HDRLEN);
289 ac->curr_frag = m;
290 }
291
292 /* split out next fragment and return it */
293 if (ac->sflag < ac->fsflag) {
294 /* we CAN'T have short packets here */
295 ac->curr_frag = m_split(m, 504, M_DONTWAIT);
295 ac->curr_frag = m_split(m, 504, M_NOWAIT);
296 if (ac->curr_frag == 0) {
297 m_freem(m);
298 return 0;
299 }
300
296 if (ac->curr_frag == 0) {
297 m_freem(m);
298 return 0;
299 }
300
301 M_PREPEND(m, ARC_HDRNEWLEN, M_DONTWAIT);
301 M_PREPEND(m, ARC_HDRNEWLEN, M_NOWAIT);
302 if (m == 0) {
303 m_freem(ac->curr_frag);
304 ac->curr_frag = 0;
305 return 0;
306 }
307
308 ah = mtod(m, struct arc_header *);
309 ah->arc_flag = ac->rsflag;
310 ah->arc_seqid = ac->ac_seqid;
311
312 ac->sflag += 2;
313 ac->rsflag = ac->sflag;
314 } else if ((m->m_pkthdr.len >=
315 ARC_MIN_FORBID_LEN - ARC_HDRNEWLEN + 2) &&
316 (m->m_pkthdr.len <=
317 ARC_MAX_FORBID_LEN - ARC_HDRNEWLEN + 2)) {
318 ac->curr_frag = 0;
319
302 if (m == 0) {
303 m_freem(ac->curr_frag);
304 ac->curr_frag = 0;
305 return 0;
306 }
307
308 ah = mtod(m, struct arc_header *);
309 ah->arc_flag = ac->rsflag;
310 ah->arc_seqid = ac->ac_seqid;
311
312 ac->sflag += 2;
313 ac->rsflag = ac->sflag;
314 } else if ((m->m_pkthdr.len >=
315 ARC_MIN_FORBID_LEN - ARC_HDRNEWLEN + 2) &&
316 (m->m_pkthdr.len <=
317 ARC_MAX_FORBID_LEN - ARC_HDRNEWLEN + 2)) {
318 ac->curr_frag = 0;
319
320 M_PREPEND(m, ARC_HDRNEWLEN_EXC, M_DONTWAIT);
320 M_PREPEND(m, ARC_HDRNEWLEN_EXC, M_NOWAIT);
321 if (m == 0)
322 return 0;
323
324 ah = mtod(m, struct arc_header *);
325 ah->arc_flag = 0xFF;
326 ah->arc_seqid = 0xFFFF;
327 ah->arc_type2 = ac->arc_type;
328 ah->arc_flag2 = ac->sflag;
329 ah->arc_seqid2 = ac->ac_seqid;
330 } else {
331 ac->curr_frag = 0;
332
321 if (m == 0)
322 return 0;
323
324 ah = mtod(m, struct arc_header *);
325 ah->arc_flag = 0xFF;
326 ah->arc_seqid = 0xFFFF;
327 ah->arc_type2 = ac->arc_type;
328 ah->arc_flag2 = ac->sflag;
329 ah->arc_seqid2 = ac->ac_seqid;
330 } else {
331 ac->curr_frag = 0;
332
333 M_PREPEND(m, ARC_HDRNEWLEN, M_DONTWAIT);
333 M_PREPEND(m, ARC_HDRNEWLEN, M_NOWAIT);
334 if (m == 0)
335 return 0;
336
337 ah = mtod(m, struct arc_header *);
338 ah->arc_flag = ac->sflag;
339 ah->arc_seqid = ac->ac_seqid;
340 }
341

--- 434 unchanged lines hidden ---
334 if (m == 0)
335 return 0;
336
337 ah = mtod(m, struct arc_header *);
338 ah->arc_flag = ac->sflag;
339 ah->arc_seqid = ac->ac_seqid;
340 }
341

--- 434 unchanged lines hidden ---