Skip to content

Commit

Permalink
Fill local PK in forward rules
Browse files Browse the repository at this point in the history
  • Loading branch information
Darkren committed Dec 6, 2019
1 parent 17f67b9 commit b8fb5ee
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions pkg/routing/rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ func (rs *RuleSummary) ToRule() (Rule, error) {
f := rs.ForwardFields
d := f.RouteDescriptor

return ForwardRule(rs.KeepAlive, rs.KeyRouteID, f.NextRID, f.NextTID, d.DstPK, d.SrcPort, d.DstPort), nil
return ForwardRule(rs.KeepAlive, rs.KeyRouteID, f.NextRID, f.NextTID, d.SrcPK, d.DstPK, d.SrcPort, d.DstPort), nil
case rs.Type == RuleIntermediaryForward:
if rs.ConsumeFields != nil || rs.ForwardFields != nil || rs.IntermediaryForwardFields == nil {
return nil, errors.New("invalid routing rule summary")
Expand Down Expand Up @@ -386,7 +386,7 @@ func ForwardRule(
keepAlive time.Duration,
key, nextRt RouteID,
nextTp uuid.UUID,
rPK cipher.PubKey,
lPK, rPK cipher.PubKey,
lPort, rPort Port,
) Rule {
rule := Rule(make([]byte, RuleHeaderSize+routeDescriptorSize+4+pkSize))
Expand All @@ -397,10 +397,10 @@ func ForwardRule(
rule.setNextRouteID(nextRt)
rule.setNextTransportID(nextTp)

rule.setSrcPK(lPK)
rule.setSrcPort(lPort)
rule.setDstPK(rPK)
rule.setSrcPK(cipher.PubKey{})
rule.setDstPort(rPort)
rule.setSrcPort(lPort)

return rule
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/setup/idreservoir.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func (idr *idReservoir) GenerateRules(fwd, rev routing.Route) (
}

if i == 0 {
rule := routing.ForwardRule(route.KeepAlive, rID, nxtRID, hop.TpID, dstPK, srcPort, dstPort)
rule := routing.ForwardRule(route.KeepAlive, rID, nxtRID, hop.TpID, srcPK, dstPK, srcPort, dstPort)
forwardRules[hop.From] = rule
} else {
rule := routing.IntermediaryForwardRule(route.KeepAlive, rID, nxtRID, hop.TpID)
Expand Down

0 comments on commit b8fb5ee

Please sign in to comment.