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"
Fix is pretty straightforward. --- a/nhrpd/nhrp_event.c +++ b/nhrpd/nhrp_event.c @@ -59,9 +59,9 @@ buf[len] = 0; debugf(NHRP_DEBUG_EVENT, "evmgr: msg: %s", buf); - if (sscanf(buf, "eventid=%" SCNu32, &eventid) != 1) + if (sscanf(buf, "eventid=%" SCNu32, &eventid) == 1) continue; - if (sscanf(buf, "result=%63s", result) != 1) + if (sscanf(buf, "result=%63s", result) == 1) continue; } debugf(NHRP_DEBUG_EVENT, "evmgr: received: eventid=%d result=%s", Fledgling script actually works now, forgive email formatting errors ---------cut here---- #!/bin/bash PROGNAME=`basename $0` VERSION="0.0.2" 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 chown $USER:$GROUP $SOCK OLDIFS="$IFS" while read -r S; do if [[ "$S" == "" ]]; then if [[ "$EVID" != "" ]]; then echo -e "eventid=$EVID\nresult=accept\n"; fi for((i=0;i<${#INTARR[@]};i++)); do if [[ "$EVINT" == "" ]]; then break; fi if [[ "${INTARR[$i]}" != "$EVINT" ]]; then continue; fi if [[ "$EVREM" == "" ]]; then break; fi if [[ "$EVNBMA" == "" ]]; then break; fi if [[ "$EVTYPE" != "dynamic" ]]; then break; fi ip neigh add $EVREM dev $EVINT lladdr $EVNBMA nud noarp if [[ "$?" != "0" ]]; then ip neigh replace $EVREM dev $EVINT lladdr $EVNBMA nud noarp fi break done unset EVID unset EVINT unset EVREM unset EVNBMA unset EVTYPE continue; fi IFS="${IFS}=" SA=($S) IFS="$OLDIFS" case "${SA[0]}" in eventid) EVID="${SA[1]}" ;; interface) EVINT="${SA[1]}" ;; type) EVTYPE="${SA[1]}" ;; remote_addr) EVREM="${SA[1]}" ;; remote_nbma) EVNBMA="${SA[1]}" ;; esac done <&"${COPROC[0]}" >&"${COPROC[1]}" kill "$COPROC_PID"
This is still broken, the patch is quite simple. I do have an upgraded script which is pretty nice. Joe Maimon wrote:
Fix is pretty straightforward.
--- a/nhrpd/nhrp_event.c +++ b/nhrpd/nhrp_event.c @@ -59,9 +59,9 @@ buf[len] = 0;
debugf(NHRP_DEBUG_EVENT, "evmgr: msg: %s", buf); - if (sscanf(buf, "eventid=%" SCNu32, &eventid) != 1) + if (sscanf(buf, "eventid=%" SCNu32, &eventid) == 1) continue; - if (sscanf(buf, "result=%63s", result) != 1) + if (sscanf(buf, "result=%63s", result) == 1) continue; } debugf(NHRP_DEBUG_EVENT, "evmgr: received: eventid=%d result=%s",
Fledgling script actually works now, forgive email formatting errors
---------cut here----
#!/bin/bash
PROGNAME=`basename $0` VERSION="0.0.2"
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 chown $USER:$GROUP $SOCK
OLDIFS="$IFS"
while read -r S; do if [[ "$S" == "" ]]; then if [[ "$EVID" != "" ]]; then echo -e "eventid=$EVID\nresult=accept\n"; fi
for((i=0;i<${#INTARR[@]};i++)); do if [[ "$EVINT" == "" ]]; then break; fi if [[ "${INTARR[$i]}" != "$EVINT" ]]; then continue; fi if [[ "$EVREM" == "" ]]; then break; fi if [[ "$EVNBMA" == "" ]]; then break; fi if [[ "$EVTYPE" != "dynamic" ]]; then break; fi
ip neigh add $EVREM dev $EVINT lladdr $EVNBMA nud noarp if [[ "$?" != "0" ]]; then ip neigh replace $EVREM dev $EVINT lladdr $EVNBMA nud noarp fi break done
unset EVID unset EVINT unset EVREM unset EVNBMA unset EVTYPE continue; fi IFS="${IFS}=" SA=($S) IFS="$OLDIFS" case "${SA[0]}" in eventid) EVID="${SA[1]}" ;; interface) EVINT="${SA[1]}" ;; type) EVTYPE="${SA[1]}" ;; remote_addr) EVREM="${SA[1]}" ;; remote_nbma) EVNBMA="${SA[1]}" ;; esac done <&"${COPROC[0]}" >&"${COPROC[1]}"
kill "$COPROC_PID"
Joe, Can you open a Pull Request at https://github.com/FRRouting/frr/pulls for this ? If not, I will take care of it. Thanks, Jafar On 2/28/21 1:57 AM, Joe Maimon wrote:
This is still broken, the patch is quite simple.
I do have an upgraded script which is pretty nice.
Joe Maimon wrote:
Fix is pretty straightforward.
--- a/nhrpd/nhrp_event.c +++ b/nhrpd/nhrp_event.c @@ -59,9 +59,9 @@ buf[len] = 0;
debugf(NHRP_DEBUG_EVENT, "evmgr: msg: %s", buf); - if (sscanf(buf, "eventid=%" SCNu32, &eventid) != 1) + if (sscanf(buf, "eventid=%" SCNu32, &eventid) == 1) continue; - if (sscanf(buf, "result=%63s", result) != 1) + if (sscanf(buf, "result=%63s", result) == 1) continue; } debugf(NHRP_DEBUG_EVENT, "evmgr: received: eventid=%d result=%s",
Fledgling script actually works now, forgive email formatting errors
---------cut here----
#!/bin/bash
PROGNAME=`basename $0` VERSION="0.0.2"
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 chown $USER:$GROUP $SOCK
OLDIFS="$IFS"
while read -r S; do if [[ "$S" == "" ]]; then if [[ "$EVID" != "" ]]; then echo -e "eventid=$EVID\nresult=accept\n"; fi
for((i=0;i<${#INTARR[@]};i++)); do if [[ "$EVINT" == "" ]]; then break; fi if [[ "${INTARR[$i]}" != "$EVINT" ]]; then continue; fi if [[ "$EVREM" == "" ]]; then break; fi if [[ "$EVNBMA" == "" ]]; then break; fi if [[ "$EVTYPE" != "dynamic" ]]; then break; fi
ip neigh add $EVREM dev $EVINT lladdr $EVNBMA nud noarp if [[ "$?" != "0" ]]; then ip neigh replace $EVREM dev $EVINT lladdr $EVNBMA nud noarp fi break done
unset EVID unset EVINT unset EVREM unset EVNBMA unset EVTYPE continue; fi IFS="${IFS}=" SA=($S) IFS="$OLDIFS" case "${SA[0]}" in eventid) EVID="${SA[1]}" ;; interface) EVINT="${SA[1]}" ;; type) EVTYPE="${SA[1]}" ;; remote_addr) EVREM="${SA[1]}" ;; remote_nbma) EVNBMA="${SA[1]}" ;; esac done <&"${COPROC[0]}" >&"${COPROC[1]}"
kill "$COPROC_PID"
_______________________________________________ frog mailing list frog@lists.frrouting.org https://lists.frrouting.org/listinfo/frog
participants (2)
-
Jafar Al-Gharaibeh -
Joe Maimon