Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
misje committed Apr 16, 2019
2 parents 87c2e3a + 19b1fa5 commit 69a33ca
Show file tree
Hide file tree
Showing 13 changed files with 506 additions and 214 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

## 0.5.1 - 2019-04-16
### Changed
- Use 1-byte alignment on DHCP options.
- Refer to salsa.debian.org for deb package source.
- Remove old bug reference in README.

### Fixed
- Allow optional values to configuration file keywords (corretly support
"pid-file" as on the command line).

## 0.5.0 - 2019-04-09
### Added
- Parse configuration from file.
- Add copyright to usage output.

### Fixed
- Fix pedantic errors from clang.

## 0.4.4 - 2019-03-25
### Fixed
- Update version number in binary.
Expand Down
3 changes: 2 additions & 1 deletion 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.4)
project(dhcpoptinj LANGUAGES C VERSION 0.5.1)
add_definitions(-DDHCPOPTINJ_VERSION="${PROJECT_VERSION}")
set(SOURCES
src/config.c
Expand Down Expand Up @@ -57,6 +57,7 @@ target_compile_options(dhcpoptinj PRIVATE
-Wold-style-definition
-fstack-protector
-Wwrite-strings
-Wmissing-field-initializers
-D_POSIX_SOURCE
-D_DEFAULT_SOURCE
-D_FORTIFY_SOURCE=2
Expand Down
61 changes: 42 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,12 @@ this option as the last option automatically.

## Installing

dhcoptinj is quite a simple program and should be unproblematic to build.
dhcpoptinj is submitted to Debian and will hopefully make it to unstable (and
consequently testing and stable) in not too long. The deb package is under
source control at [salsa](https://salsa.debian.org/misje-guest/dhcpoptinj).
Installing dhcpoptinj from the deb package is recommended over the following
manual installation procedure, because it also includes a man page, bash
completion rules, example files etc.

### Prerequisites

Expand All @@ -99,13 +104,6 @@ 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 All @@ -115,11 +113,44 @@ use a build directory, you can get rid of all the cmake rubbish by running `git
clean -dfx`. Note, however, that this removes **everything** in the project
directory that is not under source control.

## Configuration file

dhcptopinj will attempt to parse /etc/dhcpoptinj.conf or the file passed with
-c/--conf-file. The syntax of the configuration file is
* **key=value**, where *key* is the long option name, or
* **key** if the option does not take an argument

Whitespace is optional. Anything after and including the character **#** is
considered a comment. DHCP options are listed one-by-one as *option=01:02:03*.
Quotes around the option hex string is optional, and the bytes may be separated
by any number of non-hexadecimal characters.

The options *version*, *help* and *conf-file* are not accepted in a
configuration file.

Example:
```conf
# Run in foreground:
foreground
# Enable debug output:
debug
# Override hostname to "fjasehost":
option = '0C 66 6A 61 73 65 68 6F 73 74'
# Send agent ID "Fjas":
option = "52:01:04:46:6A:61:73"
# Override address request to ask for 10.20.30.40:
option=320A141E28
# Use queue 12:
queue = 12
remove-existing-opt # Remove options before inserting
```

## Help

This readme should have got you started. There is no man page for dhcpoptinj,
but the help (`dhcpoptinj -h`) should cover everything the utility has to
offer.
This readme should have got you started. Also check out the man page (in the
deb package) and the help output (`dhcpoptinj -h`), which should cover
everything the utility has to offer.

For bugs and suggestions please create an issue.

Expand All @@ -142,14 +173,6 @@ following are missing features that hopefully will be added some day:

### Known issues

I am not experienced in the netfilter library. There may be (although I cannot
promise) bugs.

1. *Syscall param socketcall.sendto(msg) points to uninitialised byte(s)*
valgrind error

This issue is not fully investigated yet.

1. Memory leak on non-normal exit.

This is not considered a leak. However, there should be no memory leak on a
Expand Down
Loading

0 comments on commit 69a33ca

Please sign in to comment.