[FROG] nhrpd event manager

Joe Maimon jmaimon at jmaimon.com
Sun Mar 15 04:17:55 EDT 2020


I have successfully gotten frr,nhrpd,strongswan,charon all running on 
another system for a dmvpn application.

I am currently trying to do another setup, but without vpn/ipsec, just 
nhrp/gre.

Its not working out well, debug logs show Netlink: Received msg_type 28 
which if I recall correctly suggests that the neighbor entry isnt being 
installed correctly, trying it as root worked even less.

So while poking around, I see there is an entire event manager unix sock 
structure. Perhaps I can parse that and do it myself?

However, this is as far as I got. I am interacting with it via shell script.

Mar 15 08:11:35 debian67 nhrpd[20977]: evmgr: sending event 
authorize-binding
Mar 15 08:11:35 debian67 nhrpd[20977]: Send Registration-Reply(4) 
192.168.241.129 -> 192.168.241.130
Mar 15 08:11:35 debian67 nhrpd[20977]: PACKET: Send 45.77.146.76 -> 
209.51.164.27
Mar 15 08:11:35 debian67 nhrpd[20977]: evmgr: msg: eventid=214
Mar 15 08:11:35 debian67 nhrpd[20977]: evmgr: msg: result=accept
Mar 15 08:11:35 debian67 nhrpd[20977]: evmgr: msg:
Mar 15 08:11:35 debian67 nhrpd[20977]: evmgr: received: eventid=214 result=
Mar 15 08:11:45 debian67 nhrpd[20977]: cache: t67 192.168.241.130: timeout
Mar 15 08:11:46 debian67 nhrpd[20977]: Netlink: Received msg_type 28, 
msg_flags 0

I have looked at the source and I cant seem to convince the function to 
recognize that result should be "accept".

Any advice appreciated.

Joe

For the interested, the below is the fledgling script


#!/bin/bash

PROGNAME=`basename $0`
VERSION="0.0.1"

usage()
{
         echo "Usage: $PROGNAME -s nhrp-sock [-i interface-name] [-u 
user] [-g group] "
         echo ""
         echo "-s nhrp-sock file"
         echo "-i interface-name to execute on, may be repeated multiple 
times"
         echo "-u user to own the sock"
         echo "-g group to own the sock"

         exit 1
}

SOCK="/var/run/frr/nhrp.sock"
USER="frr"
GROUP="frr"
j=0

while getopts s:i:u:g: opt; do
         case "$opt" in
                 s)
                         SOCK="$OPTARG"
                         ;;
                 i)
                         INTARR[((j++))]="$OPTARG"
                         ;;
                 u)
                         USER="$OPTARG"
                         ;;
                 g)
                         GROUP="$OPTARG"
                         ;;
         esac;
done

coproc socat - UNIX-LISTEN:$SOCK,unlink-early,setuid-early=$USER || exit 1

OLDIFS="$IFS"

while read -r S; do
         if [[ "$S" == "" ]]; then
                 if [[ "$EVID" != "" ]]; then echo -e 
"eventid=$EVID\nresult=accept\n"; fi

                 unset EVID
                 unset EVINT
                 continue;
         fi
         IFS="${IFS}="
         SA=($S)
         IFS="$OLDIFS"
         case "${SA[0]}" in
                 eventid)
                         EVID="${SA[1]}"
                         ;;
                 interface)
                         EVINT="${SA[1]}"

         esac
done <&"${COPROC[0]}" >&"${COPROC[1]}"

kill "$COPROC_PID"





More information about the frog mailing list