Restart dhcp relay-agent command script restarting dhcp server instead?

I am wondering if the command below to restart relay-agent is working as intended?
Found this during a recent issue I was experiencing with my dhcp-relay settings and just want to make sure.

restart dhcp relay-agent

After running, the log shows below

Jul 17 16:04:59 vyos007 sudo[18784]: mario : TTY=pts/0 ; PWD=/home/mario ; USER=root ; COMMAND=/usr/libexec/vyos/op_mode/restart_dhcp_relay.py --ipv4
Jul 17 16:04:59 vyos007 sudo[18788]: root : TTY=pts/0 ; PWD=/home/mario ; USER=root ; COMMAND=/usr/bin/systemctl restart isc-dhcp-server.service

I thought its a bit strange its restarting the dhcp server instead of relay?
Check file /usr/libexec/vyos/op_mode/restart_dhcp_relay.py and sure enough its not restarting the dhcp relay… hmm!

mario@vyos007:~$ cat /usr/libexec/vyos/op_mode/restart_dhcp_relay.py




import sys
import argparse
import os

import vyos.config
from vyos.util import call

parser = argparse.ArgumentParser()
parser.add_argument(“–ipv4”, action=“store_true”, help=“Restart IPv4 DHCP relay”)
parser.add_argument(“–ipv6”, action=“store_true”, help=“Restart IPv6 DHCP relay”)

if name == ‘main’:
args = parser.parse_args()
c = vyos.config.Config()

if args.ipv4:
    # Do nothing if service is not configured
    if not c.exists_effective('service dhcp-relay'):
        print("DHCP relay service not configured")
    else:
        call('systemctl restart isc-dhcp-server.service')

    sys.exit(0)
elif args.ipv6:
    # Do nothing if service is not configured
    if not c.exists_effective('service dhcpv6-relay'):
        print("DHCPv6 relay service not configured")
    else:
        call('systemctl restart isc-dhcp-server6.service')

    sys.exit(0)
else:
    parser.print_help()
    sys.exit(1)

I’m pretty sure dhcp-relay is provided by the dhcp service itself :slight_smile:

That is what I wanted to check as I was using

systemctl restart isc-dhcp-relay.service

Cheers!