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 9, 2019
2 parents 87c2e3a + 137069a commit 15c2d23
Show file tree
Hide file tree
Showing 13 changed files with 484 additions and 195 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

## 0.5.0 - 2019-04-19
### 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.0)
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
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,39 @@ 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,
Expand Down
Loading

0 comments on commit 15c2d23

Please sign in to comment.