Add new reject channel to router so we can send back rejected packets to adapter (e.g. for ICMPv6 Packet Too Big), implement ICMPv6 PTB in TUN/TAP instead of router

This commit is contained in:
Neil Alexander 2019-03-28 09:50:13 +00:00
parent 0715e829c2
commit eb22ed44ac
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
3 changed files with 135 additions and 96 deletions

View file

@ -13,12 +13,13 @@ type Adapter struct {
Core *Core
Send chan<- []byte
Recv <-chan []byte
Reject <-chan RejectedPacket
Reconfigure chan chan error
}
// Defines the minimum required functions for an adapter type
type adapterImplementation interface {
Init(*config.NodeState, *log.Logger, chan<- []byte, <-chan []byte)
Init(*config.NodeState, *log.Logger, chan<- []byte, <-chan []byte, <-chan RejectedPacket)
Name() string
MTU() int
IsTAP() bool
@ -29,9 +30,10 @@ type adapterImplementation interface {
}
// Initialises the adapter.
func (adapter *Adapter) Init(config *config.NodeState, log *log.Logger, send chan<- []byte, recv <-chan []byte) {
func (adapter *Adapter) Init(config *config.NodeState, log *log.Logger, send chan<- []byte, recv <-chan []byte, reject <-chan RejectedPacket) {
log.Traceln("Adapter setup - given channels:", send, recv)
adapter.Send = send
adapter.Recv = recv
adapter.Reject = reject
adapter.Reconfigure = make(chan chan error, 1)
}