summaryrefslogtreecommitdiff
path: root/accel-pppd/ctrl
diff options
context:
space:
mode:
authorVladislav Grishenko <themiron@mail.ru>2019-02-02 23:02:30 +0500
committerVladislav Grishenko <themiron@mail.ru>2019-02-02 23:02:30 +0500
commit7bea60cca67a9f6560ae5e11fd1edae8f81b857c (patch)
tree8148e2fd466dd1a783303a2eda930d61c423f28b /accel-pppd/ctrl
parent185c2b5d40443c47c82bf90ac016129fa7329f4c (diff)
downloadaccel-ppp-7bea60cca67a9f6560ae5e11fd1edae8f81b857c.tar.gz
accel-ppp-7bea60cca67a9f6560ae5e11fd1edae8f81b857c.zip
ipoe: dhcpv4: add wins1/wins2 config options support
Diffstat (limited to 'accel-pppd/ctrl')
-rw-r--r--accel-pppd/ctrl/ipoe/dhcpv4.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/accel-pppd/ctrl/ipoe/dhcpv4.c b/accel-pppd/ctrl/ipoe/dhcpv4.c
index 6c97bc8..9427e14 100644
--- a/accel-pppd/ctrl/ipoe/dhcpv4.c
+++ b/accel-pppd/ctrl/ipoe/dhcpv4.c
@@ -38,6 +38,8 @@ struct dhcpv4_relay_ctx {
static int conf_verbose;
static in_addr_t conf_dns1;
static in_addr_t conf_dns2;
+static in_addr_t conf_wins1;
+static in_addr_t conf_wins2;
static mempool_t pack_pool;
static mempool_t opt_pool;
@@ -696,6 +698,7 @@ int dhcpv4_send_reply(int msg_type, struct dhcpv4_serv *serv, struct dhcpv4_pack
struct dhcpv4_option *opt;
in_addr_t addr[2];
int dns_avail = 0;
+ int wins_avail = 0;
int val, r;
pack = dhcpv4_packet_alloc();
@@ -742,6 +745,8 @@ int dhcpv4_send_reply(int msg_type, struct dhcpv4_serv *serv, struct dhcpv4_pack
continue;
else if (opt->type == 6)
dns_avail = 1;
+ else if (opt->type == 44)
+ wins_avail = 1;
if (dhcpv4_packet_add_opt(pack, opt->type, opt->data, opt->len))
goto out_err;
}
@@ -756,6 +761,15 @@ int dhcpv4_send_reply(int msg_type, struct dhcpv4_serv *serv, struct dhcpv4_pack
goto out_err;
}
+ if (!wins_avail) {
+ if (conf_wins1)
+ addr[wins_avail++] = conf_wins1;
+ if (conf_wins2)
+ addr[wins_avail++] = conf_wins2;
+ if (wins_avail && dhcpv4_packet_add_opt(pack, 44, addr, wins_avail * sizeof(addr[0])))
+ goto out_err;
+ }
+
*pack->ptr++ = 255;
if (conf_verbose) {
@@ -1231,6 +1245,14 @@ static void load_config()
opt = conf_get_opt("dns", "dns2");
if (opt)
conf_dns2 = inet_addr(opt);
+
+ opt = conf_get_opt("wins", "wins1");
+ if (opt)
+ conf_wins1 = inet_addr(opt);
+
+ opt = conf_get_opt("wins", "wins2");
+ if (opt)
+ conf_wins2 = inet_addr(opt);
}
static void init()