Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
misje committed Mar 2, 2019
2 parents ec80d98 + 6442791 commit 4c3aa89
Show file tree
Hide file tree
Showing 20 changed files with 306 additions and 211 deletions.
10 changes: 0 additions & 10 deletions .gitignore

This file was deleted.

144 changes: 0 additions & 144 deletions .ycm_extra_conf.py

This file was deleted.

6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ else()
set(CMAKE_INSTALL_PREFIX /usr CACHE STRING "Choose install prefix")
endif()

project(dhcpoptinj LANGUAGES C VERSION 0.4.1)
project(dhcpoptinj LANGUAGES C VERSION 0.4.2)
add_definitions(-DDHCPOPTINJ_VERSION="${PROJECT_VERSION}")
set(SOURCES
src/config.c
Expand All @@ -30,7 +30,9 @@ set(HEADERS
src/udp.h
)
add_executable(dhcpoptinj ${SOURCES} ${HEADERS})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic -std=c99 -D_POSIX_SOURCE -D_DEFAULT_SOURCE")
set_property(TARGET dhcpoptinj PROPERTY C_STANDARD 99)
target_compile_options(dhcpoptinj PRIVATE -Wall -Wextra -pedantic -Wcast-align -Wcast-qual -Wdisabled-optimization -Wformat=2 -Winit-self -Wlogical-op -Wmissing-declarations -Wmissing-include-dirs -Wredundant-decls -Wshadow -Wsign-conversion -Wstrict-overflow=5 -Wswitch-default -Wundef -Werror -Wno-unused -Wmissing-prototypes -Wstrict-prototypes -Wold-style-definition -fstack-protector -Wwrite-strings -D_POSIX_SOURCE -D_DEFAULT_SOURCE -D_FORTIFY_SOURCE=2)

find_library(NFQ_LIB netfilter_queue REQUIRED)
target_link_libraries(dhcpoptinj ${NFQ_LIB})
install(TARGETS dhcpoptinj DESTINATION sbin)
Expand Down
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ layout](https://tools.ietf.org/html/rfc3046#section-2.0)) is as follows:
| 01 | 4 | 46 6A 61 73 ("Fjas") |

Note that dhcpoptinj does not care about what you write in the option payloads,
neither does it check whether your option code exists. It does however forbid
you to use the option code 255 (the terminating end option). dhcpoptinj inserts
nor does it check whether your option code exists. It does however forbid you
to use the option code 255 (the terminating end option). dhcpoptinj inserts
this option as the last option automatically.

## Installing
Expand All @@ -99,6 +99,13 @@ install cmake libnetfilter-queue-dev`.
1. Install (optional, but you will benefit from having dhcpoptinj in your
PATH): `sudo make install`

The makefile does not install the man page (doc/dhcpoptinj.8) nor the bash
completion file (debian/dhcpoptinj.bash-completion). Debhelper does such a good
job of making sure that these files are installed correctly, making sure the
completions work instantly and that the man-db is updated. I have no intention
of duplicating this installation logic, so please use the deb package if you
want these extra files.

### Demolish

1. Run `sudo make uninstall` from your build directory
Expand Down
2 changes: 0 additions & 2 deletions buildDeb

This file was deleted.

3 changes: 0 additions & 3 deletions cleanDeb

This file was deleted.

2 changes: 2 additions & 0 deletions debian/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ dhcpoptinj.prerm.debhelper
dhcpoptinj.substvars
files
debhelper-build-stamp
.debhelper
dhcpoptinj
11 changes: 11 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
dhcpoptinj (0.4.2-1) unstable; urgency=medium
* Update debian/control
* Add copyright file
* Bash completion for both long and short options
* Add man page
* Update usage string
* Fix compiler warnings (pedantic signed/unsigned issues and void function
declarations)

-- Andreas Misje <[email protected]> Thu, 17 Jan 2019 08:45:35 +0100

dhcpoptinj (0.4.1-1) unstable; urgency=low
* Update version number in --version output

Expand Down
12 changes: 7 additions & 5 deletions debian/control
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
Source: dhcpoptinj
Maintainer: Andreas Misje <[email protected]>
Section: net
Priority: extra
Homepage: http://github.com/misje/dhcpoptinj
Build-Depends: debhelper (>= 9), libnetfilter-queue-dev (>= 1)
Priority: optional
Standards-Version: 3.9.8
Homepage: https://github.com/misje/dhcpoptinj
Vcs-Git: git://github.com/misje/dhcpoptinj
Build-Depends: debhelper (>= 9~), libnetfilter-queue-dev (>= 1)

Package: dhcpoptinj
Architecture: any
Depends: ${misc:Depends}, ${shlibs:Depends}
Recommends: iptables-persistent
Description: DHCP option injector
dhcpoptinj is a simple utility for injecting DHCP options into DHCP packets.
dhcpoptinj is implemented using netfilter-queue.
It is implemented using netfilter-queue and mangles packets, either by
inserting new options or replacing existing options.
5 changes: 5 additions & 0 deletions debian/copyright
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/

Files: *
Copyright: Copyright (c) 2013–2019, Andreas Misje
License: GPL-3.0-only
29 changes: 13 additions & 16 deletions debian/dhcpoptinj.bash-completion
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,20 @@

_dhcpoptinj()
{
local cur prev words cword split
_init_completion -s || return
local cur prev words cword split
_init_completion -s || return

case $prev in
-h|--help|-v|--version)
return
;;
esac
case $prev in
-h|--help|-v|--version)
return
;;
esac

if [[ "$cur" == -* ]]; then
# This helper script only manages to fetch long options (it does not
# seem to like dhcpoptinj's help text format), but we can live with
# that:
COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") )
[[ $COMPREPLY == *= ]] && compopt -o nospace
return 0
fi
if [[ "$cur" == -* ]]; then
COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") )
[[ $COMPREPLY == *= ]] && compopt -o nospace
return 0
fi
} && complete -F _dhcpoptinj dhcpoptinj

# ex: ts=4 sw=4 filetype=sh
1 change: 1 addition & 0 deletions debian/manpages
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docs/dhcpoptinj.8
5 changes: 4 additions & 1 deletion debian/rules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#!/usr/bin/make -f
%:
dh $@ --parallel --buildsystem=cmake --builddirectory=build --with bash-completion
dh $@ --parallel --buildsystem=cmake --builddirectory=build --with bash-completion

override_dh_auto_configure:
dh_auto_configure -- --no-warn-unused-cli
1 change: 1 addition & 0 deletions debian/source/format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0 (quilt)
Loading

0 comments on commit 4c3aa89

Please sign in to comment.