Deleted Added
full compact
ip_output.c (262747) ip_output.c (262763)
1/*-
2 * Copyright (c) 1982, 1986, 1988, 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)ip_output.c 8.3 (Berkeley) 1/21/94
30 */
31
32#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1982, 1986, 1988, 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)ip_output.c 8.3 (Berkeley) 1/21/94
30 */
31
32#include <sys/cdefs.h>
33__FBSDID("$FreeBSD: head/sys/netinet/ip_output.c 262747 2014-03-04 19:49:41Z glebius $");
33__FBSDID("$FreeBSD: head/sys/netinet/ip_output.c 262763 2014-03-05 01:17:47Z glebius $");
34
35#include "opt_inet.h"
36#include "opt_ipfw.h"
37#include "opt_ipsec.h"
38#include "opt_mbuf_stress_test.h"
39#include "opt_mpath.h"
40#include "opt_route.h"
41#include "opt_sctp.h"

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

289 goto sendit;
290#endif
291 IPSTAT_INC(ips_noroute);
292 error = EHOSTUNREACH;
293 goto bad;
294 }
295 ia = ifatoia(rte->rt_ifa);
296 ifp = rte->rt_ifp;
34
35#include "opt_inet.h"
36#include "opt_ipfw.h"
37#include "opt_ipsec.h"
38#include "opt_mbuf_stress_test.h"
39#include "opt_mpath.h"
40#include "opt_route.h"
41#include "opt_sctp.h"

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

289 goto sendit;
290#endif
291 IPSTAT_INC(ips_noroute);
292 error = EHOSTUNREACH;
293 goto bad;
294 }
295 ia = ifatoia(rte->rt_ifa);
296 ifp = rte->rt_ifp;
297 rte->rt_rmx.rmx_pksent++;
297 counter_u64_add(rte->rt_pksent, 1);
298 if (rte->rt_flags & RTF_GATEWAY)
299 gw = (struct sockaddr_in *)rte->rt_gateway;
300 if (rte->rt_flags & RTF_HOST)
301 isbroadcast = (rte->rt_flags & RTF_BROADCAST);
302 else
303 isbroadcast = in_broadcast(gw->sin_addr, ifp);
304 }
305 /*
306 * Calculate MTU. If we have a route that is up, use that,
307 * otherwise use the interface's MTU.
308 */
309 if (rte != NULL && (rte->rt_flags & (RTF_UP|RTF_HOST))) {
310 /*
311 * This case can happen if the user changed the MTU
312 * of an interface after enabling IP on it. Because
313 * most netifs don't keep track of routes pointing to
314 * them, there is no way for one to update all its
315 * routes when the MTU is changed.
316 */
298 if (rte->rt_flags & RTF_GATEWAY)
299 gw = (struct sockaddr_in *)rte->rt_gateway;
300 if (rte->rt_flags & RTF_HOST)
301 isbroadcast = (rte->rt_flags & RTF_BROADCAST);
302 else
303 isbroadcast = in_broadcast(gw->sin_addr, ifp);
304 }
305 /*
306 * Calculate MTU. If we have a route that is up, use that,
307 * otherwise use the interface's MTU.
308 */
309 if (rte != NULL && (rte->rt_flags & (RTF_UP|RTF_HOST))) {
310 /*
311 * This case can happen if the user changed the MTU
312 * of an interface after enabling IP on it. Because
313 * most netifs don't keep track of routes pointing to
314 * them, there is no way for one to update all its
315 * routes when the MTU is changed.
316 */
317 if (rte->rt_rmx.rmx_mtu > ifp->if_mtu)
318 rte->rt_rmx.rmx_mtu = ifp->if_mtu;
319 mtu = rte->rt_rmx.rmx_mtu;
317 if (rte->rt_mtu > ifp->if_mtu)
318 rte->rt_mtu = ifp->if_mtu;
319 mtu = rte->rt_mtu;
320 } else {
321 mtu = ifp->if_mtu;
322 }
323 /* Catch a possible divide by zero later. */
324 KASSERT(mtu > 0, ("%s: mtu %d <= 0, rte=%p (rt_flags=0x%08x) ifp=%p",
325 __func__, mtu, rte, (rte != NULL) ? rte->rt_flags : 0, ifp));
326 if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr))) {
327 m->m_flags |= M_MCAST;

--- 1000 unchanged lines hidden ---
320 } else {
321 mtu = ifp->if_mtu;
322 }
323 /* Catch a possible divide by zero later. */
324 KASSERT(mtu > 0, ("%s: mtu %d <= 0, rte=%p (rt_flags=0x%08x) ifp=%p",
325 __func__, mtu, rte, (rte != NULL) ? rte->rt_flags : 0, ifp));
326 if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr))) {
327 m->m_flags |= M_MCAST;

--- 1000 unchanged lines hidden ---