View | Details | Raw Unified | Return to bug 27782
Collapse All | Expand All

(-)/tmp/ip_fil.c (+33 lines)
Lines 1284-1289 Link Here
1284
	struct route iproute;
1284
	struct route iproute;
1285
	frentry_t *fr;
1285
	frentry_t *fr;
1286
1286
1287
#ifdef	__FreeBSD__
1288
	/*
1289
	 * HOT FIX/KLUDGE:
1290
	 *
1291
	 * If the mbuf we're about to send is not writable (because of
1292
	 * a cluster reference, for example) we'll need to make a copy
1293
	 * of it since this routine modifies the contents.  
1294
	 *
1295
	 * If you have non-crappy network hardware that can transmit data
1296
	 * from the mbuf, rather than making a copy, this is gonna be a
1297
	 * problem.
1298
	 */
1299
1300
	if (M_WRITABLE(m) == 0) {
1301
	  if ((m0 = m_dup(m, M_DONTWAIT)) != 0) {
1302
	    m_freem(m);
1303
	    m = m0;
1304
	  } else {
1305
	    error = ENOBUFS;
1306
	    m_freem(m);
1307
	    ipl_frouteok[1]++;
1308
	    return 0;
1309
	  }
1310
	}
1311
#endif
1312
1287
	hlen = fin->fin_hlen;
1313
	hlen = fin->fin_hlen;
1288
	ip = mtod(m0, struct ip *);
1314
	ip = mtod(m0, struct ip *);
1289
1315
Lines 1379-1390 Link Here
1379
# if	BSD >= 199306
1405
# if	BSD >= 199306
1380
		int i = 0;
1406
		int i = 0;
1381
1407
1408
#ifdef		__FreeBSD__
1409
		/* HOT FIX: we've already made a copy of the mbuf
1410
		   above, so we won't need to restore it here. */
1411
#else		/* __FreeBSD__ */
1382
#  ifdef	MCLISREFERENCED
1412
#  ifdef	MCLISREFERENCED
1383
		if ((m->m_flags & M_EXT) && MCLISREFERENCED(m))
1413
		if ((m->m_flags & M_EXT) && MCLISREFERENCED(m))
1384
#  else
1414
#  else
1385
		if (m->m_flags & M_EXT)
1415
		if (m->m_flags & M_EXT)
1386
#  endif
1416
#  endif
1387
			i = 1;
1417
			i = 1;
1418
#endif		/* __FreeBSD__ */
1388
# endif
1419
# endif
1389
# ifndef sparc
1420
# ifndef sparc
1390
#  ifndef __FreeBSD__
1421
#  ifndef __FreeBSD__
Lines 1399-1405 Link Here
1399
		error = (*ifp->if_output)(ifp, m, (struct sockaddr *)dst,
1430
		error = (*ifp->if_output)(ifp, m, (struct sockaddr *)dst,
1400
					  ro->ro_rt);
1431
					  ro->ro_rt);
1401
		if (i) {
1432
		if (i) {
1433
#  ifndef __FreeBSD__
1402
			ip->ip_id = ntohs(ip->ip_id);
1434
			ip->ip_id = ntohs(ip->ip_id);
1435
#  endif
1403
			ip->ip_len = ntohs(ip->ip_len);
1436
			ip->ip_len = ntohs(ip->ip_len);
1404
			ip->ip_off = ntohs(ip->ip_off);
1437
			ip->ip_off = ntohs(ip->ip_off);
1405
		}
1438
		}

Return to bug 27782