Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Localhop #94

Merged
merged 11 commits into from
Jan 3, 2025
10 changes: 4 additions & 6 deletions dv/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ import (
)

const CostInfinity = uint64(16)
const MulticastStrategy = "/localhost/nfd/strategy/multicast"
const NlsrOrigin = uint64(128)

var Localhop = enc.Name{enc.NewStringComponent(enc.TypeGenericNameComponent, "localhop")}
var Localhost = enc.Name{enc.NewStringComponent(enc.TypeGenericNameComponent, "localhost")}
var MulticastStrategy, _ = enc.NameFromStr("/localhost/nfd/strategy/multicast")

type Config struct {
// Network should be the same for all routers in the network.
Expand Down Expand Up @@ -81,7 +79,7 @@ func (c *Config) Parse() (err error) {
}

// Create name table
c.advSyncPfxN = append(Localhop, append(c.networkNameN,
c.advSyncPfxN = append(enc.Name{enc.LOCALHOP}, append(c.networkNameN,
enc.NewStringComponent(enc.TypeKeywordNameComponent, "DV"),
enc.NewStringComponent(enc.TypeKeywordNameComponent, "ADS"),
)...)
Expand All @@ -91,7 +89,7 @@ func (c *Config) Parse() (err error) {
c.advSyncPassivePfxN = append(c.advSyncPfxN,
enc.NewStringComponent(enc.TypeKeywordNameComponent, "PSV"),
)
c.advDataPfxN = append(Localhop, append(c.routerNameN,
c.advDataPfxN = append(enc.Name{enc.LOCALHOP}, append(c.routerNameN,
enc.NewStringComponent(enc.TypeKeywordNameComponent, "DV"),
enc.NewStringComponent(enc.TypeKeywordNameComponent, "ADV"),
)...)
Expand All @@ -103,7 +101,7 @@ func (c *Config) Parse() (err error) {
enc.NewStringComponent(enc.TypeKeywordNameComponent, "DV"),
enc.NewStringComponent(enc.TypeKeywordNameComponent, "PFX"),
)
c.localPfxN = append(Localhost,
c.localPfxN = append(enc.Name{enc.LOCALHOST},
enc.NewStringComponent(enc.TypeGenericNameComponent, "nlsr"),
)

Expand Down
3 changes: 1 addition & 2 deletions dv/dv/advert_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package dv
import (
"time"

"github.com/named-data/ndnd/dv/config"
"github.com/named-data/ndnd/dv/tlv"
enc "github.com/named-data/ndnd/std/encoding"
"github.com/named-data/ndnd/std/log"
Expand All @@ -20,7 +19,7 @@ func (dv *Router) advertDataFetch(nodeId enc.Name, seqNo uint64) {
return
}

advName := append(config.Localhop, append(nodeId,
advName := append(enc.Name{enc.LOCALHOP}, append(nodeId,
enc.NewStringComponent(enc.TypeKeywordNameComponent, "DV"),
enc.NewStringComponent(enc.TypeKeywordNameComponent, "ADV"),
enc.NewSequenceNumComponent(seqNo), // unused for now
Expand Down
1 change: 0 additions & 1 deletion dv/dv/advert_sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ func (dv *Router) advertSyncSendInterestImpl(prefix enc.Name) (err error) {
}

// State Vector for our group
// TODO: switch to new TLV types
sv := &svs_2024.StateVectorAppParam{
StateVector: &svs_2024.StateVector{
Entries: []*svs_2024.StateVectorEntry{{
Expand Down
3 changes: 1 addition & 2 deletions dv/dv/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ func (dv *Router) register() (err error) {
}

// Set strategy to multicast for sync prefixes
mcast, _ := enc.NameFromStr(config.MulticastStrategy)
pfxs = []enc.Name{
dv.config.AdvertisementSyncPrefix(),
dv.config.PrefixTableSyncPrefix(),
Expand All @@ -240,7 +239,7 @@ func (dv *Router) register() (err error) {
Args: &mgmt.ControlArgs{
Name: prefix,
Strategy: &mgmt.Strategy{
Name: mcast,
Name: config.MulticastStrategy,
},
},
Retries: -1,
Expand Down
2 changes: 1 addition & 1 deletion dv/table/neighbor_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func (ns *NeighborState) delete() {
}

func (ns *NeighborState) localRoute() enc.Name {
return append(config.Localhop, append(ns.Name,
return append(enc.Name{enc.LOCALHOP}, append(ns.Name,
enc.NewStringComponent(enc.TypeKeywordNameComponent, "DV"),
)...)
}
Expand Down
5 changes: 3 additions & 2 deletions fw/defn/pkt.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ type Pkt struct {

PitToken []byte
CongestionMark *uint64
IncomingFaceID *uint64
NextHopFaceID *uint64
CachePolicy *uint64

IncomingFaceID uint64
NextHopFaceID *uint64
}
2 changes: 1 addition & 1 deletion fw/dispatch/face.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type Face interface {
type OutPkt struct {
Pkt *defn.Pkt
PitToken []byte
InFace *uint64
InFace uint64
}

// FaceDispatch is used to allow forwarding to interact with faces without a circular dependency issue.
Expand Down
3 changes: 1 addition & 2 deletions fw/face/internal-transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ func (t *InternalTransport) runReceive() {

func (t *InternalTransport) Close() {
if t.running.Swap(false) {
close(t.recvQueue)
close(t.sendQueue)
// do not close the queues, let them be garbage collected
}
}
Loading
Loading