diff options
author | Hans Dedecker <dedeckeh@gmail.com> | 2017-11-28 15:08:27 +0100 |
---|---|---|
committer | Hans Dedecker <dedeckeh@gmail.com> | 2017-12-06 10:30:33 +0100 |
commit | c516801e3dbb992ce1ea5274439b9b30888d9fb1 (patch) | |
tree | 057186b8a30ff591ed296e015cf5f8464a9cc06f /src/odhcpd.c | |
parent | 92e205df59af022e0cfe6e0243b3ef572fc38f5c (diff) |
dhcpv4: notify DHCP ACK and RELEASE via ubus
If the ubus object has any subscription notify DHCP ACK and DHCP RELEASE
events using ubus notifications.
Signed-off-by: Borja Salazar <borja.salazar@fon.com>
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
Diffstat (limited to 'src/odhcpd.c')
-rw-r--r-- | src/odhcpd.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/odhcpd.c b/src/odhcpd.c index 13697b7..97a6de9 100644 --- a/src/odhcpd.c +++ b/src/odhcpd.c @@ -466,6 +466,16 @@ void odhcpd_hexlify(char *dst, const uint8_t *src, size_t len) *dst = 0; } +const char *odhcpd_print_mac(const uint8_t *mac, const size_t len) +{ + static char buf[32]; + + snprintf(buf, sizeof(buf), "%02x", mac[0]); + for (size_t i = 1, j = 2; i < len && j < sizeof(buf); i++, j += 3) + snprintf(buf + j, sizeof(buf) - j, ":%02x", mac[i]); + + return buf; +} int odhcpd_bmemcmp(const void *av, const void *bv, size_t bits) { |