Skip to content

Instantly share code, notes, and snippets.

@tomaskrcka
Created July 10, 2015 08:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomaskrcka/f017a27d6fefc6c1adb0 to your computer and use it in GitHub Desktop.
Save tomaskrcka/f017a27d6fefc6c1adb0 to your computer and use it in GitHub Desktop.
Forced adding of dhcp option to dhcp response to coova-chilli version 1.2.8
--- coova-chilli-1.2.8_orig/src/dhcp.c 2011-07-12 11:10:15.000000000 +0200
+++ coova-chilli-1.2.8/src/dhcp.c 2014-07-23 13:25:16.000000000 +0200
@@ -2470,21 +2470,12 @@ dhcp_create_pkt(uint8_t type, uint8_t *p
uint8_t *lhead = _options.dhcp_options;
struct dhcp_tag_t *opt = (struct dhcp_tag_t *)lhead;
while (opt && opt->t && opt->l) {
- int param_count = param_list->l;
- int i;
-
log_dbg("DHCP Type: %d Length: %d", (int)opt->t, (int)opt->l);
- /* for each configured option, iterate the param_list */
- for (i=0; i < param_count; i++) {
- if (param_list->v[i] == opt->t) {
- if (pos + opt->l + 2 < DHCP_OPTIONS_LEN) {
- memcpy(&pack_dhcp->options[pos], opt,
- opt->l + 2);
- pos += opt->l + 2;
- }
- break;
- }
+ if (pos + opt->l + 2 < DHCP_OPTIONS_LEN) {
+ memcpy(&pack_dhcp->options[pos], opt,
+ opt->l + 2);
+ pos += opt->l + 2;
}
lhead += opt->l + 2;
@tomaskrcka
Copy link
Author

Originally the dhcp option was added if it was requested.

@carcabot
Copy link

carcabot commented Oct 8, 2015

Hi, can you give us an example of using ?

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment