Date: Wed, 31 Dec 2008 01:51:07 +0000 (UTC) From: Kip Macy <kmacy@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r186621 - user/kmacy/HEAD_fast_net/sys/netinet Message-ID: <200812310151.mBV1p7Sl011368@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kmacy Date: Wed Dec 31 01:51:07 2008 New Revision: 186621 URL: http://svn.freebsd.org/changeset/base/186621 Log: initialize ro_dst at the beginning of ip_forward Modified: user/kmacy/HEAD_fast_net/sys/netinet/ip_input.c Modified: user/kmacy/HEAD_fast_net/sys/netinet/ip_input.c ============================================================================== --- user/kmacy/HEAD_fast_net/sys/netinet/ip_input.c Wed Dec 31 01:42:24 2008 (r186620) +++ user/kmacy/HEAD_fast_net/sys/netinet/ip_input.c Wed Dec 31 01:51:07 2008 (r186621) @@ -1348,6 +1348,7 @@ ip_forward(struct mbuf *m, int srcrt) struct in_ifaddr *ia = NULL; struct mbuf *mcopy; struct in_addr dest; + struct sockaddr_in *sin; struct route ro; int error, type = 0, code = 0, mtu = 0; int flerror; @@ -1368,6 +1369,12 @@ ip_forward(struct mbuf *m, int srcrt) #ifdef IPSTEALTH } #endif + bzero(&ro, sizeof(ro)); + sin = (struct sockaddr_in *)&ro.ro_dst; + sin->sin_family = AF_INET; + sin->sin_len = sizeof(*sin); + sin->sin_addr = ip->ip_dst; + flerror = flowtable_lookup(ipv4_forward_ft, m, &ro); if (flerror == 0) ia = ifatoia(ro.ro_rt->rt_ifa); @@ -1430,22 +1437,15 @@ ip_forward(struct mbuf *m, int srcrt) */ dest.s_addr = 0; if (!srcrt && V_ipsendredirects && ia->ia_ifp == m->m_pkthdr.rcvif) { - struct sockaddr_in *sin; struct rtentry *rt; - if (flerror != 0) { - - bzero(&ro, sizeof(ro)); - sin = (struct sockaddr_in *)&ro.ro_dst; - sin->sin_family = AF_INET; - sin->sin_len = sizeof(*sin); - sin->sin_addr = ip->ip_dst; + if (flerror != 0) in_rtalloc_ign(&ro, 0, M_GETFIB(m)); - } - + rt = ro.ro_rt; - if (rt && (rt->rt_flags & (RTF_DYNAMIC|RTF_MODIFIED)) == 0 && + if (rt != NULL && + (rt->rt_flags & (RTF_DYNAMIC|RTF_MODIFIED)) == 0 && satosin(rt_key(rt))->sin_addr.s_addr != 0) { #define RTA(rt) ((struct in_ifaddr *)(rt->rt_ifa)) u_long src = ntohl(ip->ip_src.s_addr);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200812310151.mBV1p7Sl011368>