Giter Club home page Giter Club logo

router's Introduction

Router in C#

Made for WANT 2019.

GUI

This is server-only. GUI can be found here.

Features:

  • ARP (proxy ARP)
  • C, S Routing
  • Dynamic Routing using RIP
  • LLDP
  • Snniffing packets
  • DHCP server

router's People

Contributors

dependabot[bot] avatar m1k1o avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

router's Issues

ProxyARP Preload

Fetch ARP on Proxy ARP request and andswer only 100% valid IPs.

C & S

Moze byt rovnaka C siet aj S?
Co ak je C, moze vzniknut S?
Co ak je S, moze vzniknut C?

RTEs to byte[]

            int newSize = 4 + (value.Count * 20);
            if(newSize != Data.Length)
            {
                Array.Resize(ref Data, 4 + (value.Count * 20));
            }

            var ms = new MemoryStream();
            foreach (RTE item in value)
            {
                var itemBytes = item.Bytes;
                ms.Write(itemBytes, 0, itemBytes.Length);
            }

            var Dst = ms.ToArray();
            Array.Copy(Data, 4, Dst, 0, Dst.Length);

Payload Packet

Append payload to any packets.

Extend existing GeneratorPacket class to payload. Existing payload cases can overrite default method. => Get rid of Generator Payload.

RIP Holddown

Ked sa prijme siet s metrikou 16 a uz sa nachadza v RIP Tabulke nejaka siet, prepne sa do stavu Holddown. Avsak ked ten stav vyprsi, tak potom zostane ta povodna siet v tabulke aktivna? Alebo sa stane rovno inactive?

RIP: Out of range when no Routes

On an RIP Packet arrival, Packet.cs went out of index.

        protected byte[] Slice(int o, int len)
        {
            var Value = new Byte[len];
            for (var i = 0; i < len && i < Length; i++)
            {
                Value[i] = RawData[o + i];
            }

            return Value;
        }
   at Router.Helpers.Packet.Slice(Int32 o, Int32 len) in C:\Users\m1k1o\source\repos\Router\Router\Helpers\Packet.cs:line 119
   at Router.Protocols.RIPPacket.get_RouteCollection() in C:\Users\m1k1o\source\repos\Router\Router\Protocols\RIPPacket.cs:line 32
   at Router.RIP.RIPService.OnPacketArrival(Handler Handler) in C:\Users\m1k1o\source\repos\Router\Router\RIP\RIPService.cs:line 98
   at Router.PacketArrival.Invoke(Handler Handler)
   at Router.Interface.<.ctor>b__28_0(RawCapture Packet) in C:\Users\m1k1o\source\repos\Router\Router\Interface.cs:line 30
   at Router.Helpers.Device.<Start>b__26_0(Object sender, CaptureEventArgs e) in C:\Users\m1k1o\source\repos\Router\Router\Helpers\Device.cs:line 94
   at SharpPcap.LibPcap.PcapDevice.SendPacketArrivalEvent(RawCapture p)
   at SharpPcap.WinPcap.WinPcapDevice.SendPacketArrivalEvent(RawCapture p)
   at SharpPcap.LibPcap.PcapDevice.PacketHandler(IntPtr param, IntPtr header, IntPtr data)
   at SharpPcap.LibPcap.LibPcapSafeNativeMethods.pcap_dispatch(IntPtr adaptHandle, Int32 count, pcap_handler callback, IntPtr ptr)
   at SharpPcap.LibPcap.PcapDevice.CaptureThread()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

Sync / Async ?

Samotný routing by mal byť synchrónny - v akom poradí sa prijmú paktety v takom poradí sa odošlú.

ARP musí byť asynchrónny - ak čaká paket na spracovanie, pošle ARP request, nikdy by ho nedočkal lebo sám blokuje príjmanie.

RIP môže / nemusí byť asynchrónny.

RIP Flush timer

Po expirovani Flush Timeru treba ihned vymazat, nie pasivne.

DHCP auto END

Auto add END at the end of collection if not present.

Zmena IP a Masky počas behu

IP a Maska sa dá meniť počas behu. Tieto zmeny sa musia odraziť aj v Routing a RIP tabuľke.

Spraviť mutovať IP a Network je časť riešenia, pre RT je to v pohode, avšak pri RIP môžu nastať konflikty, ak by sa už nachádzala taká sieť v tabuľke od toho interface-u.

RIP Routa po prijati metriky 16

Keď smerovač prijme cestu s metrikou 16, odstráni ju zo smerovacej tabuľky, ale zostáva v databáze ako possibly down, pošle triggered update o tejto sieti s metrikou 16.

ICMP bad checksum

Data:

0000   08 00 4b bd 00 9b 03 bb 54 45 53 54 53 K½»TESTS

Tree:

Internet Control Message Protocol
    Type: 8 (Echo (ping) request)
    Code: 0
    Checksum: 0x4bbd incorrect, should be 0xf90f
        [Expert Info (Warning/Checksum): Bad checksum [should be 0xf90f]]
            [Bad checksum [should be 0xf90f]]
            [Severity level: Warning]
            [Group: Checksum]
    [Checksum Status: Bad]
    Identifier (BE): 155 (0x009b)
    Identifier (LE): 39680 (0x9b00)
    Sequence number (BE): 955 (0x03bb)
    Sequence number (LE): 47875 (0xbb03)
    Data (5 bytes)
        Data: 5445535453
        [Length: 5]

RIP Sync with RT

do RT sa dostanu tie RIP zaznamy, ktore sa nezhoduju s C a S ?

Generator + Sniffing

This should be one structure. Generator should be able to:

  • export packets to JSON.
  • import packets from Bytes.

Generator is already able to:

  • export packets to Bytes.
  • import packets from new-line separated chunk of datas (should be JSON).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.