Don't bother to read echoed messages to rtsock; failures will be
authorKeith Sklower <sklower@ucbvax.Berkeley.EDU>
Sat, 23 Jun 1990 06:41:19 +0000 (22:41 -0800)
committerKeith Sklower <sklower@ucbvax.Berkeley.EDU>
Sat, 23 Jun 1990 06:41:19 +0000 (22:41 -0800)
noted via normal errno mechanism, and this is run on the local system anyway for now.

SCCS-vsn: sbin/route/route.c 5.27

usr/src/sbin/route/route.c

index 2fda3f0..a7997e2 100644 (file)
@@ -12,7 +12,7 @@ char copyright[] =
 #endif /* not lint */
 
 #ifndef lint
 #endif /* not lint */
 
 #ifndef lint
-static char sccsid[] = "@(#)route.c    5.26 (Berkeley) %G%";
+static char sccsid[] = "@(#)route.c    5.27 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/param.h>
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -141,6 +141,7 @@ char *argv[];
                } m_u;
        } m;
 
                } m_u;
        } m;
 
+       shutdown(s, 0); /* Don't want to read back our messages */
        if (argc > 1) {
                argv++;
                if (argc == 2 && **argv == '-') switch (keyword(1 + *argv)) {
        if (argc > 1) {
                argv++;
                if (argc == 2 && **argv == '-') switch (keyword(1 + *argv)) {
@@ -175,16 +176,6 @@ char *argv[];
                        printf("got only %d for rlen\n", rlen);
                        break;
                }
                        printf("got only %d for rlen\n", rlen);
                        break;
                }
-       again:
-               if ((rlen = read(s, (char *)&m, sizeof (m))) < 0) {
-                       perror("reading from routing socket");
-                       printf("got only %d for rlen\n", rlen);
-                       break;
-               }
-               if ((m.m_rtm.rtm_pid != pid) || (m.m_rtm.rtm_seq != seqno)) {
-                       printf("Got response for somebody else's request");
-                       goto again;
-               }
                seqno++;
                if (qflag)
                        continue;
                seqno++;
                if (qflag)
                        continue;
@@ -411,6 +402,7 @@ newroute(argc, argv)
        struct hostent *hp = 0;
        extern int errno;
 
        struct hostent *hp = 0;
        extern int errno;
 
+       shutdown(s, 0); /* Don't want to read back our messages */
        cmd = argv[0];
        while (--argc > 0) {
                if (**(++argv)== '-') {
        cmd = argv[0];
        while (--argc > 0) {
                if (**(++argv)== '-') {
@@ -853,24 +845,6 @@ rtmsg(cmd, flags)
                printf("got only %d for rlen\n", rlen);
                return (-1);
        }
                printf("got only %d for rlen\n", rlen);
                return (-1);
        }
-again:
-       if ((rlen = read(s, (char *)&m_rtmsg, l)) < 0) {
-               perror("reading from routing socket");
-               printf("got only %d for rlen\n", rlen);
-               return (-1);
-       }
-       if ((m_rtmsg.m_rtm.rtm_pid != pid) ||
-           (m_rtmsg.m_rtm.rtm_seq != seq)) {
-               printf("Got response for somebody else's request");
-               goto again;
-       }
-       if (qflag == 0)
-               print_rtmsg( &m_rtmsg.m_rtm, rlen);
-       if ((m_rtmsg.m_rtm.rtm_flags & RTF_DONE) == 0) {
-               errno = m_rtmsg.m_rtm.rtm_errno;
-               perror("response from routing socket turned down");
-               return (-1);
-       }
        return (0);
 }
 
        return (0);
 }