Add missing path flags
Adds `InfoF` and `ConsDirFlag` to packets generated by `RtrPktFromScnPkt`
Fixes `validateLocalIF: Interface is nil` error that was thrown in `replyEgress`
@@ -100,6 +100,12 @@ func RtrPktFromScnPkt(sp *spkt.ScnPkt, dirTo rcmn.Dir, ctx *rctx.Ctx) (*RtrPkt,
rp.CmnHdr.TotalLen = uint16(len(rp.Raw))
rp.CmnHdr.Write(rp.Raw)
}
+ if _, err := rp.InfoF(); err != nil {
+ return nil, err
+ }
+ if _, err := rp.ConsDirFlag(); err != nil {
+ return nil, err
+ }
return rp, nil
}
@@ -196,8 +202,6 @@ func (rp *RtrPkt) CreateReply(sp *spkt.ScnPkt) (*RtrPkt, error) {
return nil, err
}
if hopF != nil && hopF.Xover {
- reply.InfoF()
- reply.ConsDirFlag()
// Always increment reversed path on a xover point.
if _, err := reply.IncPath(); err != nil {
return nil, err
@@ -212,8 +216,6 @@ func (rp *RtrPkt) CreateReply(sp *spkt.ScnPkt) (*RtrPkt, error) {
}
}
} else if rp.DirFrom == rcmn.DirExternal {
- reply.InfoF()
- reply.ConsDirFlag()
// Increase path if the current HOF is not xover and
// this router is an ingress router.
if _, err := reply.IncPath(); err != nil {
