don't respond to broadcasts
authorMike Karels <karels@ucbvax.Berkeley.EDU>
Tue, 15 Oct 1985 09:39:49 +0000 (01:39 -0800)
committerMike Karels <karels@ucbvax.Berkeley.EDU>
Tue, 15 Oct 1985 09:39:49 +0000 (01:39 -0800)
SCCS-vsn: sys/netinet/tcp_input.c 6.15

usr/src/sys/netinet/tcp_input.c

index 757fc79..2e01026 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)tcp_input.c 6.14 (Berkeley) %G%
+ *     @(#)tcp_input.c 6.15 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -337,6 +337,7 @@ tcp_input(m0)
         * If the state is LISTEN then ignore segment if it contains an RST.
         * If the segment contains an ACK then it is bad and send a RST.
         * If it does not contain a SYN then it is not interesting; drop it.
         * If the state is LISTEN then ignore segment if it contains an RST.
         * If the segment contains an ACK then it is bad and send a RST.
         * If it does not contain a SYN then it is not interesting; drop it.
+        * Don't bother responding if the destination was a broadcast.
         * Otherwise initialize tp->rcv_nxt, and tp->irs, select an initial
         * tp->iss, and send a segment:
         *     <SEQ=ISS><ACK=RCV_NXT><CTL=SYN,ACK>
         * Otherwise initialize tp->rcv_nxt, and tp->irs, select an initial
         * tp->iss, and send a segment:
         *     <SEQ=ISS><ACK=RCV_NXT><CTL=SYN,ACK>
@@ -355,6 +356,8 @@ tcp_input(m0)
                        goto dropwithreset;
                if ((tiflags & TH_SYN) == 0)
                        goto drop;
                        goto dropwithreset;
                if ((tiflags & TH_SYN) == 0)
                        goto drop;
+               if (in_broadcast(ti->ti_dst))
+                       goto drop;
                am = m_get(M_DONTWAIT, MT_SONAME);
                if (am == NULL)
                        goto drop;
                am = m_get(M_DONTWAIT, MT_SONAME);
                if (am == NULL)
                        goto drop;
@@ -873,8 +876,9 @@ dropwithreset:
        /*
         * Generate a RST, dropping incoming segment.
         * Make ACK acceptable to originator of segment.
        /*
         * Generate a RST, dropping incoming segment.
         * Make ACK acceptable to originator of segment.
+        * Don't bother to respond if destination was broadcast.
         */
         */
-       if (tiflags & TH_RST)
+       if ((tiflags & TH_RST) || in_broadcast(ti->ti_dst))
                goto drop;
        if (tiflags & TH_ACK)
                tcp_respond(tp, ti, (tcp_seq)0, ti->ti_ack, TH_RST);
                goto drop;
        if (tiflags & TH_ACK)
                tcp_respond(tp, ti, (tcp_seq)0, ti->ti_ack, TH_RST);