diff options
author | Daniil Baturin <daniil@vyos.io> | 2024-09-30 16:13:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-30 16:13:02 +0100 |
commit | e961fcbca3dffd9de36b342aad57341999e44a11 (patch) | |
tree | 921c7ec13ce9a60c5be1a8d8dfac86ee364d2377 /src/etc/dhcp/dhclient-enter-hooks.d/03-vyos-ipwrapper | |
parent | 4d63611ea56389b8344efb97251a79c2d41bd565 (diff) | |
parent | 630113e74872d47d54d6b6234a864514d582193c (diff) | |
download | vyos-1x-e961fcbca3dffd9de36b342aad57341999e44a11.tar.gz vyos-1x-e961fcbca3dffd9de36b342aad57341999e44a11.zip |
Merge pull request #4103 from vyos/mergify/bp/circinus/pr-4002
dhclient: T6667: Added workaround for communication with FRR (backport #4002)
Diffstat (limited to 'src/etc/dhcp/dhclient-enter-hooks.d/03-vyos-ipwrapper')
-rw-r--r-- | src/etc/dhcp/dhclient-enter-hooks.d/03-vyos-ipwrapper | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/etc/dhcp/dhclient-enter-hooks.d/03-vyos-ipwrapper b/src/etc/dhcp/dhclient-enter-hooks.d/03-vyos-ipwrapper index 5d879471d..2a1c5a7b2 100644 --- a/src/etc/dhcp/dhclient-enter-hooks.d/03-vyos-ipwrapper +++ b/src/etc/dhcp/dhclient-enter-hooks.d/03-vyos-ipwrapper @@ -72,6 +72,22 @@ function delroute () { fi } +# try to communicate with vtysh +function vtysh_conf () { + # perform 10 attempts with 1 second delay for retries + for i in {1..10} ; do + if vtysh -c "conf t" -c "$1" ; then + logmsg info "Command was executed successfully via vtysh: \"$1\"" + return 0 + else + logmsg info "Failed to send command to vtysh, retrying in 1 second" + sleep 1 + fi + done + logmsg error "Failed to execute command via vtysh after 10 attempts: \"$1\"" + return 1 +} + # replace ip command with this wrapper function ip () { # pass comand to system `ip` if this is not related to routes change @@ -84,7 +100,7 @@ function ip () { delroute ${@:4} iptovtysh $@ logmsg info "Sending command to vtysh" - vtysh -c "conf t" -c "$VTYSH_CMD" + vtysh_conf "$VTYSH_CMD" else # add ip route to kernel logmsg info "Modifying routes in kernel: \"/usr/sbin/ip $@\"" |