A userspace application that filters DHCP floods to protect a DHCP server. It uses the Netfilter userspace packet queuing API.
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

Makefile 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. # Copyright 2019 Pascal Gloor
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. CC := gcc
  15. CCFLAGS := -Wall -O2
  16. LDFLAGS := -lnetfilter_queue
  17. TARGETS:= dhcp_protect
  18. MAINS := $(dhcp_protect .o, $(TARGETS) )
  19. OBJ := dhcp_protect.o $(MAINS)
  20. DEPS := dhcp_protect.h
  21. .PHONY: all clean install uninstall
  22. help:
  23. @echo "make <all|clean|install|uninstall>"
  24. all: $(TARGETS)
  25. clean:
  26. rm -f $(TARGETS) $(OBJ)
  27. install:
  28. systemctl stop dhcp_protect
  29. cp dhcp_protect /usr/local/bin/
  30. cp dhcp_protect.conf /usr/local/etc/
  31. cp dhcp_protect.service /etc/systemd/system/
  32. chmod 644 /etc/systemd/system/dhcp_protect.service
  33. systemctl enable dhcp_protect
  34. systemctl start dhcp_protect
  35. uninstall:
  36. systemctl stop dhcp_protect
  37. systemctl disable dhcp_protect
  38. rm -f /usr/local/bin/dhcp_protect
  39. rm -f /usr/local/etc/dhcp_protect.conf
  40. rm -f /etc/systemd/system/dhcp_protect.service
  41. $(OBJ): %.o : %.c $(DEPS)
  42. $(CC) -c -o $@ $< $(CCFLAGS)
  43. $(TARGETS): % : $(filter-out $(MAINS), $(OBJ)) %.o
  44. $(CC) -o $@ $(LIBS) $^ $(CCFLAGS) $(LDFLAGS)