On Tue, Mar 27, 2001 at 10:19:22AM -0600, Jonathan Lemon wrote:
> On Tue, Mar 27, 2001 at 01:12:47PM +0200, Jesper Skriver wrote:
> > On Tue, Mar 27, 2001 at 12:45:31PM +0200, Jeroen Ruigrok/Asmodai wrote:
> > > [making sure Jesper and Jonathan see this]
> > > 
> > > -On [20010326 18:00], Bill Fenner ([EMAIL PROTECTED]) wrote:
> > > >Now that an ICMP port unreachable returns ENETRESET and not ECONNREFUSED,
> > > >setting the date on the command line results in a bogusly-reported error.
> > > >Before you fix the bug in date/netdate.c, it tends to report EADDRINUSE;
> > > >afterwards it tends to report ENETRESET.
> > > >
> > > >Why did the handling of "udp port unreachable" have to change?  ECONNREFUSED
> > > >was a perfectly fine return value for that.  I'm reasonably sure that
> > > >there are other programs out there that think that ECONNREFUSED is what
> > > >you get when you get an ICMP port unreachable back after a UDP send,
> > > >so I doubt that the answer is to simply fix date(1).
> > > 
> > > FWIW I think the correct thing would be to return ECONNREFUSED.
> > > 
> > > Looking at intro(2) it would seem that ECONNREFUSED fits the shoe since
> > > the connection is actively refused.
> 
> I forget why I picked ENETRESET; probably because it was the first
> thing that leaped out at me when I quickly skimmed over <sys/errno.h>
> looking for an appropriate error code; but I didn't consider the UDP
> case.

That is the below diff

Index: src/sys/netinet/ip_input.c
===================================================================
RCS file: /home/ncvs/src/sys/netinet/ip_input.c,v
retrieving revision 1.130.2.21
diff -u -r1.130.2.21 ip_input.c
--- src/sys/netinet/ip_input.c  2001/03/08 23:14:54     1.130.2.21
+++ src/sys/netinet/ip_input.c  2001/03/27 16:35:15
@@ -1484,7 +1484,7 @@
        EHOSTUNREACH,   EHOSTUNREACH,   ECONNREFUSED,   ECONNREFUSED,
        EMSGSIZE,       EHOSTUNREACH,   0,              0,
        0,              0,              0,              0,
-       ENOPROTOOPT,    ENETRESET
+       ENOPROTOOPT,    ECONNREFUSED
 };
 
 /*

or perhaps this ?

Index: src/sys/netinet/ip_icmp.c
===================================================================
RCS file: /home/ncvs/src/sys/netinet/ip_icmp.c,v
retrieving revision 1.39.2.6
diff -u -r1.39.2.6 ip_icmp.c
--- src/sys/netinet/ip_icmp.c   2001/03/08 23:14:54     1.39.2.6
+++ src/sys/netinet/ip_icmp.c   2001/03/27 16:30:51
@@ -350,7 +350,7 @@
                         */
                        case ICMP_UNREACH_PROTOCOL:
                        case ICMP_UNREACH_PORT:
-                               code = PRC_UNREACH_ADMIN_PROHIB;
+                               code = PRC_UNREACH_PORT;
                                break;
 
                        case ICMP_UNREACH_NET_PROHIB:
Index: src/sys/netinet/tcp_subr.c
===================================================================
RCS file: /home/ncvs/src/sys/netinet/tcp_subr.c,v
retrieving revision 1.73.2.11
diff -u -r1.73.2.11 tcp_subr.c
--- src/sys/netinet/tcp_subr.c  2001/03/05 13:09:03     1.73.2.11
+++ src/sys/netinet/tcp_subr.c  2001/03/27 16:32:01
@@ -978,7 +978,8 @@
 
        if (cmd == PRC_QUENCH)
                notify = tcp_quench;
-       else if (icmp_may_rst && cmd == PRC_UNREACH_ADMIN_PROHIB && ip)
+       else if (icmp_may_rst && (cmd == PRC_UNREACH_ADMIN_PROHIB ||
+               cmd == PRC_UNREACH_PORT) && ip)
                notify = tcp_drop_syn_sent;
        else if (cmd == PRC_MSGSIZE)
                notify = tcp_mtudisc;

/Jesper

-- 
Jesper Skriver, jesper(at)skriver(dot)dk  -  CCIE #5456
Work:    Network manager   @ AS3292 (Tele Danmark DataNetworks)
Private: FreeBSD committer @ AS2109 (A much smaller network ;-)

One Unix to rule them all, One Resolver to find them,
One IP to bring them all and in the zone to bind them.

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-net" in the body of the message

Reply via email to