ip_output.c revision fe0336dab2332556574fab2b79ab4210a7989127
639N/A * Copyright (C) 2006-2010 Oracle Corporation 639N/A * This file is part of VirtualBox Open Source Edition (OSE), as 639N/A * you can redistribute it and/or modify it under the terms of the GNU 639N/A * General Public License (GPL) as published by the Free Software 639N/A * Foundation, in version 2 as it comes in the "COPYING" file of the 639N/A * VirtualBox OSE distribution. VirtualBox OSE is distributed in the 639N/A * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. 639N/A * This code is based on: 2362N/A * Copyright (c) 1982, 1986, 1988, 1990, 1993 2362N/A * The Regents of the University of California. All rights reserved. 639N/A * Redistribution and use in source and binary forms, with or without 639N/A * modification, are permitted provided that the following conditions 639N/A * 1. Redistributions of source code must retain the above copyright 639N/A * notice, this list of conditions and the following disclaimer. 639N/A * 2. Redistributions in binary form must reproduce the above copyright 639N/A * notice, this list of conditions and the following disclaimer in the 639N/A * documentation and/or other materials provided with the distribution. 639N/A * 3. All advertising materials mentioning features or use of this software 639N/A * must display the following acknowledgement: 639N/A * This product includes software developed by the University of 639N/A * California, Berkeley and its contributors. 639N/A * 4. Neither the name of the University nor the names of its contributors 639N/A * may be used to endorse or promote products derived from this software 639N/A * without specific prior written permission. 639N/A * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 639N/A * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 639N/A * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 639N/A * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 639N/A * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 639N/A * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 639N/A * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 639N/A * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 639N/A * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 639N/A * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 639N/A * Changes and additions relating to SLiRP are 639N/A * Copyright (c) 1995 Danny Gasparovski. * Please read the file COPYRIGHT for the * terms and conditions of the copyright. 0xff,
0xff,
0xff,
0xff,
0xff,
0xff * no chance to send this packet, sorry, we will request ether address via ARP * IP output. The packet in mbuf chain m contains a skeletal IP * header (with len, off, ttl, proto, tos, src, dst). * The mbuf chain containing the packet will be freed. * The mbuf opt, if present, will not be freed. register int hlen =
sizeof(
struct ip );
#
if 0
/* We do no options */ /* Current TCP/IP stack hasn't routing information at * all so we need to calculate destination ethernet address * If small enough for interface, can just send directly. Log((
"NAT: packet was droppped\n"));
* Too large for interface; fragment if possible. * Must be able to put at least 8 bytes per fragment. char *
buf;
/* intermediate buffer we'll use for copy from orriginal packet */ /*we've receives packet in fragments*/ Log((
"NAT: packet was droppped\n"));
Log2((
"NAT: LibAlias return %d\n",
rcLa));
* Loop through length of segment after first fragment, * make new header and copy data of each part and link onto chain. /* we've calculated eth_dst for first packet */ if (
hlen >
sizeof (
struct ip))
* Update first fragment by trimming what's been copied out * and updating header, then send each fragment (in order).