Skip to content

tiannian/auip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

auip

auip is a async uip stack.

Layer

Mac Layer

MAC Layer support these packet type:

  • EthernetII
  • IEEE802.3
    • VLAN (802.3q)
    • QinQ (802.3q)

Network Layer

Network support these packet and function:

  • Ipv4
  • Arp
  • Ip Fragment
  • ICMP
  • Ipv6
  • ICMPv6 (NDP)

Transport Layer

  • UDP

Application Layer

  • DHCP
  • DHCPv6
  • DNS

Architecture

Device

Device is work on mac layer. It only have two function:

  • Recv frame, then input to auip. Use poll mode.
  • Send frame from auip.

Device is only a trait, you must bind a device to a interface.

pub trait Device {
    fn send(&mut self, buffer: &[u8]) -> Result<()>;

    fn recv(&mut self) -> Result<Option<&[u8]>>;

    fn medium(&self) -> Medium;
}

Currently support these device:

  • Tap (Linux, MacOS)
  • Tun (Linux, MacOS)
  • Loopback
  • Sub-port (For macvtap, vlan)

Interface

Interface same as linux's interface.

Interface have these functions

  • Set CIDR and MAC Address.
  • Bind with a Device
    • Receive packet from device, then send to socket.
    • Send ip packet to device.
  • Drop or accept packet based on
    • Vlan ID
    • Mac Address
    • IP Address
  • Hook baseed on process pcaket.

Storage

Beacuse auip support both nostd and alloc, all storage declared as trait.

  • AddrsStorage: Storage addresses for interface, include 1 mac address and multiple cidr.
  • Layer3PacketStorage: As a buffer to store layer3 packet need send to device.

Hook

Based on packet process, interface can register a hook. Hook will include some function, these function will called when packet is procedded.

Throw hook, we can build macvlan, vlan device, bridge, switch or some other special network interface. Also, we can use hook to build cross interface packet route, 6lowpan gateway, ipv6 on ble gateway and so on.

Beacuse the fundamental of auip is direct stack model, we need use hook to cross packet.

About

Async ip stack in rust

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages