move ip_id swapping to ip_forward; zap freed route so rtalloc doesn't
hand it back again
SCCS-vsn: sys/netinet/ip_output.c 6.7
-/* ip_output.c 6.6 84/08/29 */
+/* ip_output.c 6.7 85/03/18 */
#include "param.h"
#include "mbuf.h"
#include "param.h"
#include "mbuf.h"
#include "in.h"
#include "in_systm.h"
#include "in.h"
#include "in_systm.h"
#include "ip.h"
#include "ip_var.h"
#include "ip.h"
#include "ip_var.h"
ip->ip_off &= IP_DF;
ip->ip_id = htons(ip_id++);
ip->ip_hl = hlen >> 2;
ip->ip_off &= IP_DF;
ip->ip_id = htons(ip_id++);
ip->ip_hl = hlen >> 2;
- } else
- ip->ip_id = htons(ip->ip_id);
* short circuit routing lookup.
*/
if (flags & IP_ROUTETOIF) {
* short circuit routing lookup.
*/
if (flags & IP_ROUTETOIF) {
- ifp = if_ifonnetof(in_netof(ip->ip_dst));
- if (ifp == 0) {
+ struct in_ifaddr *ia;
+ ia = in_iaonnetof(in_netof(ip->ip_dst));
+ if (ia == 0) {
error = ENETUNREACH;
goto bad;
}
error = ENETUNREACH;
goto bad;
}
goto gotif;
}
rtalloc(ro);
goto gotif;
}
rtalloc(ro);
* The old route has gone away; try for a new one.
*/
rtfree(ro->ro_rt);
* The old route has gone away; try for a new one.
*/
rtfree(ro->ro_rt);
rtalloc(ro);
}
if (ro->ro_rt == 0 || (ifp = ro->ro_rt->rt_ifp) == 0) {
rtalloc(ro);
}
if (ro->ro_rt == 0 || (ifp = ro->ro_rt->rt_ifp) == 0) {
if (ro->ro_rt->rt_flags & (RTF_GATEWAY|RTF_HOST))
dst = (struct sockaddr_in *)&ro->ro_rt->rt_gateway;
gotif:
if (ro->ro_rt->rt_flags & (RTF_GATEWAY|RTF_HOST))
dst = (struct sockaddr_in *)&ro->ro_rt->rt_gateway;
gotif:
-#ifndef notdef
- /*
- * If source address not specified yet, use address
- * of outgoing interface.
- */
- if (in_lnaof(ip->ip_src) == INADDR_ANY)
- ip->ip_src.s_addr =
- ((struct sockaddr_in *)&ifp->if_addr)->sin_addr.s_addr;
-#endif
-
/*
* Look for broadcast address and
* and verify user is allowed to send
* such a packet.
*/
/*
* Look for broadcast address and
* and verify user is allowed to send
* such a packet.
*/
- if (in_lnaof(dst->sin_addr) == INADDR_ANY) {
+ if (in_broadcast(dst->sin_addr)) {
if ((ifp->if_flags & IFF_BROADCAST) == 0) {
error = EADDRNOTAVAIL;
goto bad;
if ((ifp->if_flags & IFF_BROADCAST) == 0) {
error = EADDRNOTAVAIL;
goto bad;
if (error = (*ifp->if_output)(ifp, mh, (struct sockaddr *)dst))
break;
}
if (error = (*ifp->if_output)(ifp, mh, (struct sockaddr *)dst))
break;
}
- m_freem(m);
- goto done;
-