ingress

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

README

SIG ingress pipeline

Incoming packets are processed in the following manner:

  1. Disapatcher (singleton) object reads SIG frames from the network and passes them to an appropriate Worker based on the source IA, source host address and session ID.
  2. Worker passes the frame to a ReassemblyList based on the epoch. Non-active epochs are purged in periodic manner.
  3. ReassemblyList keeps a list of frames. It processes them in a lazy manner: It only parses the content once an entire IP packet can be assembled. The reason for this is that there may be holes in the frame sequence and in that case we want to drop the old frames. Which wouldn't be possible if the frames were processed immediately as they arrive.
  4. Once a full packet is available, it is sent to the local network via the TUN device.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(tunIO io.ReadWriteCloser)

func NewFrameBufs added in v0.4.0

func NewFrameBufs(frames ringbuf.EntryList) int

Types

type Dispatcher

type Dispatcher struct {
	// contains filtered or unexported fields
}

Dispatcher reads new encapsulated packets, classifies the packet by source ISD-AS -> source host Addr -> Sess Id and hands it off to the appropriate Worker, starting a new one if none currently exists.

func NewDispatcher added in v0.4.0

func NewDispatcher(tio io.ReadWriteCloser) *Dispatcher

func (*Dispatcher) Run

func (d *Dispatcher) Run() error

type FrameBuf

type FrameBuf struct {
	// contains filtered or unexported fields
}

FrameBuf is a struct used to reassemble encapsulated packets spread over multiple SIG frames. It contains the raw bytes and metadata needed for reassembly.

func (*FrameBuf) ProcessCompletePkts

func (fb *FrameBuf) ProcessCompletePkts()

ProcessCompletePkts write all complete packets in the frame to the wire and sets the correct metadata in case there is a fragment at the end of the frame.

func (*FrameBuf) Processed

func (fb *FrameBuf) Processed() bool

Processed returns true if all fragments in the frame have been processed,

func (*FrameBuf) Release

func (fb *FrameBuf) Release()

Release reset the FrameBuf and releases it back to the ringbuf (if set).

func (*FrameBuf) Reset

func (fb *FrameBuf) Reset()

Reset resets the metadata of a FrameBuf.

func (*FrameBuf) SetProcessed

func (fb *FrameBuf) SetProcessed()

SetProcessed marks a frame as being processed.

func (*FrameBuf) String

func (fb *FrameBuf) String() string

type ReassemblyList

type ReassemblyList struct {
	// contains filtered or unexported fields
}

ReassemblyList is used to keep a doubly linked list of SIG frames that are outstanding for reassembly. The frames kept in the reassambly list sorted by their sequence numbers. There is always one reassembly list per epoch to ensure that sequence numbers are monotonically increasing.

func NewReassemblyList

func NewReassemblyList(epoch int, capacity int, s sender) *ReassemblyList

NewReassemblyList returns a ReassemblyList object for the given epoch and with given maximum capacity.

func (*ReassemblyList) Insert

func (l *ReassemblyList) Insert(frame *FrameBuf)

Insert inserts a frame into the reassembly list. After inserting the frame at the correct position, Insert tries to reassemble packets that involve the newly added frame. Completely processed frames get removed from the list and released to the pool of frame buffers.

type Worker

type Worker struct {
	log.Logger
	Remote *snet.Addr
	SessId mgmt.SessionType
	Ring   *ringbuf.Ring
	// contains filtered or unexported fields
}

Worker handles decapsulation of SIG frames.

func NewWorker

func NewWorker(remote *snet.Addr, sessId mgmt.SessionType, tunIO io.ReadWriteCloser) *Worker

func (*Worker) Run

func (w *Worker) Run()

func (*Worker) Stop

func (w *Worker) Stop()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL