Author: ae
Date: Thu Feb  6 10:48:55 2014
New Revision: 261545
URL: http://svnweb.freebsd.org/changeset/base/261545

Log:
  MFC r260702 (by melifaro):
    Fix ipfw fwd for IPv4 traffic broken by r249894.
  
    Problem case:
    Original lookup returns route with GW set, so gw points to
    rte->rt_gateway.
    After that we're changing dst and performing lookup another time.
    Since fwd host is most probably directly reachable, resulting
    rte does not contain rt_gateway, so gw is not set. Finally, we
    end with packet transmitted to proper interface but wrong
    link-layer address.

Modified:
  stable/10/sys/netinet/ip_output.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/netinet/ip_output.c
==============================================================================
--- stable/10/sys/netinet/ip_output.c   Thu Feb  6 10:47:47 2014        
(r261544)
+++ stable/10/sys/netinet/ip_output.c   Thu Feb  6 10:48:55 2014        
(r261545)
@@ -200,6 +200,13 @@ ip_output(struct mbuf *m, struct mbuf *o
                hlen = ip->ip_hl << 2;
        }
 
+       /*
+        * dst/gw handling:
+        *
+        * dst can be rewritten but always point to &ro->ro_dst
+        * gw is readonly but can be pointed either to dst OR rt_gatewy
+        * therefore we need restore GW if we're re-doing lookup
+        */
        gw = dst = (struct sockaddr_in *)&ro->ro_dst;
 again:
        ia = NULL;
@@ -219,6 +226,7 @@ again:
                RO_RTFREE(ro);
                ro->ro_lle = NULL;
                rte = NULL;
+               gw = dst;
        }
        if (rte == NULL && fwd_tag == NULL) {
                bzero(dst, sizeof(*dst));
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to