[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: strange IP question



On Thu, Dec 16, 2004 at 06:39:28PM +0100, Toni Mueller wrote:
> Hi Claudio,
> 
> On Thu, 16.12.2004 at 17:33:59 +0059, Claudio Jeker <cjeker_(_at_)_diehard_(_dot_)_n-r-g_(_dot_)_com> wrote:
> > Oh, I was just searching at the wrong spot.
> 
> huh?
> 
> > It is not fxp3 that has a MTU of 1378 but some other interface. Your
> 
> Ok, I'll need to research _that_. I thought, setting it to 1400 was
> already spec'ing the lowest MTU along the path.
> 
> > If your intrested I have a pacht that solves this problem.
> 
> I'm curious, but don't know if I can try that patch... wait, I think I
> can try that patch on a different machine, but this will take a bit
> longer. If you don't mind not getting immediate feedback...
> 
> In any case, thanks for looking into this!
> 

Here it is. This solves also the problem with traceroute reporting wrong
addresses.

-- 
:wq Claudio

Index: netinet/ip_icmp.c
===================================================================
RCS file: /cvs/src/sys/netinet/ip_icmp.c,v
retrieving revision 1.65
diff -u -p -r1.65 ip_icmp.c
--- netinet/ip_icmp.c	22 Jun 2004 07:35:20 -0000	1.65
+++ netinet/ip_icmp.c	16 Dec 2004 11:58:18 -0000
@@ -627,9 +627,8 @@ icmp_reflect(struct mbuf *m)
 	ip->ip_dst = ip->ip_src;
 	/*
 	 * If the incoming packet was addressed directly to us,
-	 * use dst as the src for the reply.  Otherwise (broadcast
-	 * or anonymous), use the address which corresponds
-	 * to the incoming interface.
+	 * use dst as the src for the reply.  For broadcast, use
+	 * the address which corresponds to the incoming interface.
 	 */
 	for (ia = in_ifaddr.tqh_first; ia; ia = ia->ia_list.tqe_next) {
 		if (t.s_addr == ia->ia_addr.sin_addr.s_addr)
@@ -638,13 +637,10 @@ icmp_reflect(struct mbuf *m)
 		    t.s_addr == ia->ia_broadaddr.sin_addr.s_addr)
 			break;
 	}
-	icmpdst.sin_addr = t;
-	if ((ia == (struct in_ifaddr *)0) && (m->m_pkthdr.rcvif != NULL))
-		ia = ifatoia(ifaof_ifpforaddr(sintosa(&icmpdst),
-		    m->m_pkthdr.rcvif));
 	/*
-	 * The following happens if the packet was not addressed to us,
-	 * and was received on an interface with no IP address.
+	 * The following happens if the packet was not addressed to us.
+	 * Use the new source address and do a route lookup. If it fails
+	 * drop the packet as there is no path to the host.
 	 */
 	if (ia == (struct in_ifaddr *)0) {
 		struct sockaddr_in *dst;
@@ -654,7 +650,7 @@ icmp_reflect(struct mbuf *m)
 		dst = satosin(&ro.ro_dst);
 		dst->sin_family = AF_INET;
 		dst->sin_len = sizeof(*dst);
-		dst->sin_addr = t;
+		dst->sin_addr = ip->ip_dst;
 
 		rtalloc(&ro);
 		if (ro.ro_rt == 0) {