View | Details | Raw Unified | Return to bug 615
Collapse All | Expand All

(-)a/src/internet-stack/ipv4-l3-protocol.cc (+2 lines)
 Lines 735-740   Ipv4L3Protocol::LocalDeliver (Ptr<const Link Here 
735
      switch (status) {
735
      switch (status) {
736
      case Ipv4L4Protocol::RX_OK:
736
      case Ipv4L4Protocol::RX_OK:
737
        // fall through
737
        // fall through
738
      case Ipv4L4Protocol::RX_ENDPOINT_CLOSED:
739
        // fall through
738
      case Ipv4L4Protocol::RX_CSUM_FAILED:
740
      case Ipv4L4Protocol::RX_CSUM_FAILED:
739
        break;
741
        break;
740
      case Ipv4L4Protocol::RX_ENDPOINT_UNREACH:
742
      case Ipv4L4Protocol::RX_ENDPOINT_UNREACH:
(-)a/src/internet-stack/ipv4-l4-protocol.h (+1 lines)
 Lines 45-50   public: Link Here 
45
  enum RxStatus {
45
  enum RxStatus {
46
    RX_OK,
46
    RX_OK,
47
    RX_CSUM_FAILED,
47
    RX_CSUM_FAILED,
48
    RX_ENDPOINT_CLOSED,
48
    RX_ENDPOINT_UNREACH
49
    RX_ENDPOINT_UNREACH
49
  };
50
  };
50
51
(-)a/src/internet-stack/tcp-l4-protocol.cc (-1 / +27 lines)
 Lines 512-518   TcpL4Protocol::Receive (Ptr<Packet> pack Link Here 
512
    source.Print (oss);
512
    source.Print (oss);
513
    oss<<" source port: "<<tcpHeader.GetSourcePort ();
513
    oss<<" source port: "<<tcpHeader.GetSourcePort ();
514
    NS_LOG_LOGIC (oss.str ());
514
    NS_LOG_LOGIC (oss.str ());
515
    return Ipv4L4Protocol::RX_ENDPOINT_UNREACH;
515
516
    if (!(tcpHeader.GetFlags () & TcpHeader::RST))
517
      {
518
        // build a RST packet and send
519
        Ptr<Packet> rstPacket = Create<Packet> ();
520
        TcpHeader header;
521
        if (tcpHeader.GetFlags () & TcpHeader::ACK)
522
          {
523
            // ACK bit was set
524
            header.SetFlags (TcpHeader::RST);
525
            header.SetSequenceNumber (header.GetAckNumber ());
526
          }
527
        else
528
          {
529
            header.SetFlags (TcpHeader::RST | TcpHeader::ACK);
530
            header.SetSequenceNumber (SequenceNumber (0));
531
            header.SetAckNumber (header.GetSequenceNumber () + SequenceNumber (1));
532
          }
533
        header.SetSourcePort (tcpHeader.GetDestinationPort ());
534
        header.SetDestinationPort (tcpHeader.GetSourcePort ());
535
        SendPacket (rstPacket, header, destination, source);
536
        return Ipv4L4Protocol::RX_ENDPOINT_CLOSED;
537
      }
538
    else
539
      {
540
        return Ipv4L4Protocol::RX_ENDPOINT_CLOSED;
541
      }
516
  }
542
  }
517
  NS_ASSERT_MSG (endPoints.size() == 1 , "Demux returned more than one endpoint");
543
  NS_ASSERT_MSG (endPoints.size() == 1 , "Demux returned more than one endpoint");
518
  NS_LOG_LOGIC ("TcpL4Protocol "<<this<<" forwarding up to endpoint/socket");
544
  NS_LOG_LOGIC ("TcpL4Protocol "<<this<<" forwarding up to endpoint/socket");

Return to bug 615