}
argsStr := strings.Join(append([]string{handle}, args...), " ")
les = append(les, LE{"Type", "exec"}, LE{"Dst", argsStr})
- cmdline, exists := sender.Exec[handle]
- if !exists || len(cmdline) == 0 {
+ cmdline := sender.Exec[handle]
+ if len(cmdline) == 0 {
err = errors.New("No handle found")
ctx.LogE(
"rx-no-handle", les, err,
return err
}
if len(sendmail) > 0 && ctx.NotifyExec != nil {
- notify, exists := ctx.NotifyExec[sender.Name+"."+handle]
- if !exists {
- notify, exists = ctx.NotifyExec["*."+handle]
+ notify := ctx.NotifyExec[sender.Name+"."+handle]
+ if notify == nil {
+ notify = ctx.NotifyExec["*."+handle]
}
- if exists {
+ if notify != nil {
cmd := exec.Command(
sendmail[0],
append(sendmail[1:], notify.To)...,
}
ctx.LogD("rx-tx", les, logMsg)
if !dryRun {
- if err = ctx.TxTrns(node, nice, int64(pktSize), pipeR); err != nil {
- ctx.LogE("rx", les, err, func(les LEs) string {
- return logMsg(les) + ": txing"
- })
- return err
+ if len(node.Via) == 0 {
+ if err = ctx.TxTrns(node, nice, int64(pktSize), pipeR); err != nil {
+ ctx.LogE("rx", les, err, func(les LEs) string {
+ return logMsg(les) + ": txing"
+ })
+ return err
+ }
+ } else {
+ via := node.Via[:len(node.Via)-1]
+ node = ctx.Neigh[*node.Via[len(node.Via)-1]]
+ node = &Node{Id: node.Id, Via: via, ExchPub: node.ExchPub}
+ pktTrns, err := NewPkt(PktTypeTrns, 0, nodeId[:])
+ if err != nil {
+ panic(err)
+ }
+ if _, err = ctx.Tx(
+ node,
+ pktTrns,
+ nice,
+ int64(pktSize), 0,
+ pipeR,
+ pktName,
+ nil,
+ ); err != nil {
+ ctx.LogE("rx", les, err, func(les LEs) string {
+ return logMsg(les) + ": txing"
+ })
+ return err
+ }
}
}
ctx.LogI("rx", les, func(les LEs) string {
})
continue
}
- if nodeId != sender.Id {
+ if nodeId != sender.Id && nodeId != pktEnc.Sender {
ctx.LogI("rx-area-echo", lesEcho, logMsgNode)
if _, err = ctx.Tx(
node, &pkt, nice, int64(pktSize), 0, fullPipeR, pktName, nil,
isBad = true
continue
}
+ sender := ctx.Neigh[*job.PktEnc.Sender]
+ if sender == nil {
+ err := errors.New("unknown node")
+ ctx.LogE("rx-open", les, err, func(les LEs) string {
+ return fmt.Sprintf(
+ "Tossing %s/%s",
+ ctx.NodeName(job.PktEnc.Sender), pktName,
+ )
+ })
+ isBad = true
+ continue
+ }
errs := make(chan error, 1)
var sharedKey []byte
Retry:
pipeR,
pktName,
les,
- ctx.Neigh[*job.PktEnc.Sender],
+ sender,
job.PktEnc.Nice,
uint64(pktSizeWithoutEnc(job.Size)),
job.Path,