Skip to content

Commit

Permalink
[dhcp-relay]: Add DHCP Relay Monitor (#3886)
Browse files Browse the repository at this point in the history
DHCP relay MONitor (dhcpmon) keeps track of DORA messages. If DHCP Relay
is detected to be not forwarding DORA message, dhcpmon will log such event
to syslog. Under the hood dhcpmon keeps counts of clients DR messages,
forwarded DR messages, DHCP server OA messages, and forwarded OA messages.
dhcpmon will check every 12 sec (configurable) if counts are monotonically
increasing and record snapshot of those counters. dhcpmon will report
discrepancies when detected between current counters and snapshot counters.

pull-request: sonic-net/sonic-buildimage#3886
signed-off-by: Tamer Ahmed <[email protected]>
  • Loading branch information
tahmed-dev authored Jan 8, 2020
0 parents commit 8e5eaa7
Show file tree
Hide file tree
Showing 14 changed files with 1,327 additions and 0 deletions.
44 changes: 44 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
RM := rm -rf
DHCPMON_TARGET := dhcpmon
CP := cp
MKDIR := mkdir
CC := gcc
MV := mv

# All of the sources participating in the build are defined here
-include src/subdir.mk
-include objects.mk

ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C_DEPS)),)
-include $(C_DEPS)
endif
endif

# Add inputs and outputs from these tool invocations to the build variables

# All Target
all: sonic-dhcpmon

# Tool invocations
sonic-dhcpmon: $(OBJS) $(USER_OBJS)
@echo 'Building target: $@'
@echo 'Invoking: GCC C Linker'
$(CC) -o "$(DHCPMON_TARGET)" $(OBJS) $(USER_OBJS) $(LIBS)
@echo 'Finished building target: $@'
@echo ' '

# Other Targets
install:
$(MKDIR) -p $(DESTDIR)/usr/sbin
$(MV) $(DHCPMON_TARGET) $(DESTDIR)/usr/sbin

deinstall:
$(RM) $(DESTDIR)/usr/sbin/$(DHCPMON_TARGET)
$(RM) -rf $(DESTDIR)/usr/sbin

clean:
-$(RM) $(EXECUTABLES)$(OBJS)$(C_DEPS) $(DHCPMON_TARGET)
-@echo ' '

.PHONY: all clean dependents
5 changes: 5 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
sonic-dhcpmon (1.0.0-0) UNRELEASED; urgency=medium

* Initial release.

-- Tamer Ahmed <[email protected]> Mon, 09 Dec 2019 12:00:00 -0700
1 change: 1 addition & 0 deletions debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9
16 changes: 16 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Source: sonic-dhcpmon
Section: devel
Priority: optional
Maintainer: Tamer Ahmed <[email protected]>
Build-Depends: debhelper (>= 8.0.0),
dh-systemd
Standards-Version: 3.9.3
Homepage: https://github.com/Azure/sonic-buildimage
XS-Go-Import-Path: github.com/Azure/sonic-buildimage

Package: sonic-dhcpmon
Architecture: any
Built-Using: ${misc:Built-Using}
Depends: libexplain51,
libevent-2.0-5
Description: SONiC DHCP Monitor
3 changes: 3 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/make -f
%:
dh $@ --with systemd
4 changes: 4 additions & 0 deletions objects.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
USER_OBJS :=

LIBS := -levent -lexplain

Loading

0 comments on commit 8e5eaa7

Please sign in to comment.