mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 18:28:25 +00:00
Add --quiet-* options.
This commit is contained in:
committed by
Simon Kelley
parent
6bd3a09fb8
commit
8c0b73d3a8
@@ -41,6 +41,7 @@ static int dhcp6_maybe_relay(struct state *state, void *inbuff, size_t sz,
|
||||
static int dhcp6_no_relay(struct state *state, int msg_type, void *inbuff, size_t sz, int is_unicast, time_t now);
|
||||
static void log6_opts(int nest, unsigned int xid, void *start_opts, void *end_opts);
|
||||
static void log6_packet(struct state *state, char *type, struct in6_addr *addr, char *string);
|
||||
static void log6_quiet(struct state *state, char *type, struct in6_addr *addr, char *string);
|
||||
static void *opt6_find (void *opts, void *end, unsigned int search, unsigned int minsize);
|
||||
static void *opt6_next(void *opts, void *end);
|
||||
static unsigned int opt6_uint(unsigned char *opt, int offset, int size);
|
||||
@@ -595,7 +596,7 @@ static int dhcp6_no_relay(struct state *state, int msg_type, void *inbuff, size_
|
||||
end_opt6(o);
|
||||
}
|
||||
|
||||
log6_packet(state, "DHCPSOLICIT", NULL, ignore ? _("ignored") : NULL);
|
||||
log6_quiet(state, "DHCPSOLICIT", NULL, ignore ? _("ignored") : NULL);
|
||||
|
||||
request_no_address:
|
||||
solicit_tags = tagif;
|
||||
@@ -815,7 +816,7 @@ static int dhcp6_no_relay(struct state *state, int msg_type, void *inbuff, size_
|
||||
*outmsgtypep = DHCP6REPLY;
|
||||
state->lease_allocate = 1;
|
||||
|
||||
log6_packet(state, "DHCPREQUEST", NULL, ignore ? _("ignored") : NULL);
|
||||
log6_quiet(state, "DHCPREQUEST", NULL, ignore ? _("ignored") : NULL);
|
||||
|
||||
if (ignore)
|
||||
return 0;
|
||||
@@ -928,7 +929,7 @@ static int dhcp6_no_relay(struct state *state, int msg_type, void *inbuff, size_
|
||||
/* set reply message type */
|
||||
*outmsgtypep = DHCP6REPLY;
|
||||
|
||||
log6_packet(state, "DHCPRENEW", NULL, NULL);
|
||||
log6_quiet(state, "DHCPRENEW", NULL, NULL);
|
||||
|
||||
for (opt = state->packet_options; opt; opt = opt6_next(opt, state->end))
|
||||
{
|
||||
@@ -1011,8 +1012,11 @@ static int dhcp6_no_relay(struct state *state, int msg_type, void *inbuff, size_
|
||||
message = _("address invalid");
|
||||
}
|
||||
|
||||
log6_packet(state, "DHCPREPLY", req_addr, message);
|
||||
|
||||
if (message)
|
||||
log6_packet(state, "DHCPREPLY", req_addr, message);
|
||||
else
|
||||
log6_quiet(state, "DHCPREPLY", req_addr, message);
|
||||
|
||||
o1 = new_opt6(OPTION6_IAADDR);
|
||||
put_opt6(req_addr, sizeof(*req_addr));
|
||||
put_opt6_long(preferred_time);
|
||||
@@ -1034,7 +1038,7 @@ static int dhcp6_no_relay(struct state *state, int msg_type, void *inbuff, size_
|
||||
/* set reply message type */
|
||||
*outmsgtypep = DHCP6REPLY;
|
||||
|
||||
log6_packet(state, "DHCPCONFIRM", NULL, NULL);
|
||||
log6_quiet(state, "DHCPCONFIRM", NULL, NULL);
|
||||
|
||||
for (opt = state->packet_options; opt; opt = opt6_next(opt, state->end))
|
||||
{
|
||||
@@ -1055,7 +1059,7 @@ static int dhcp6_no_relay(struct state *state, int msg_type, void *inbuff, size_
|
||||
return 1;
|
||||
}
|
||||
|
||||
log6_packet(state, "DHCPREPLY", req_addr, state->hostname);
|
||||
log6_quiet(state, "DHCPREPLY", req_addr, state->hostname);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1084,7 +1088,7 @@ static int dhcp6_no_relay(struct state *state, int msg_type, void *inbuff, size_
|
||||
else
|
||||
state->send_domain = get_domain6(NULL);
|
||||
|
||||
log6_packet(state, "DHCPINFORMATION-REQUEST", NULL, ignore ? _("ignored") : state->hostname);
|
||||
log6_quiet(state, "DHCPINFORMATION-REQUEST", NULL, ignore ? _("ignored") : state->hostname);
|
||||
if (ignore)
|
||||
return 0;
|
||||
*outmsgtypep = DHCP6REPLY;
|
||||
@@ -1098,7 +1102,7 @@ static int dhcp6_no_relay(struct state *state, int msg_type, void *inbuff, size_
|
||||
/* set reply message type */
|
||||
*outmsgtypep = DHCP6REPLY;
|
||||
|
||||
log6_packet(state, "DHCPRELEASE", NULL, NULL);
|
||||
log6_quiet(state, "DHCPRELEASE", NULL, NULL);
|
||||
|
||||
for (opt = state->packet_options; opt; opt = opt6_next(opt, state->end))
|
||||
{
|
||||
@@ -1160,7 +1164,7 @@ static int dhcp6_no_relay(struct state *state, int msg_type, void *inbuff, size_
|
||||
/* set reply message type */
|
||||
*outmsgtypep = DHCP6REPLY;
|
||||
|
||||
log6_packet(state, "DHCPDECLINE", NULL, NULL);
|
||||
log6_quiet(state, "DHCPDECLINE", NULL, NULL);
|
||||
|
||||
for (opt = state->packet_options; opt; opt = opt6_next(opt, state->end))
|
||||
{
|
||||
@@ -1610,7 +1614,7 @@ static void add_address(struct state *state, struct dhcp_context *context, unsig
|
||||
}
|
||||
}
|
||||
|
||||
log6_packet(state, state->lease_allocate ? "DHCPREPLY" : "DHCPADVERTISE", addr, state->hostname);
|
||||
log6_quiet(state, state->lease_allocate ? "DHCPREPLY" : "DHCPADVERTISE", addr, state->hostname);
|
||||
|
||||
}
|
||||
|
||||
@@ -1880,6 +1884,12 @@ static void log6_opts(int nest, unsigned int xid, void *start_opts, void *end_op
|
||||
}
|
||||
}
|
||||
|
||||
static void log6_quiet(struct state *state, char *type, struct in6_addr *addr, char *string)
|
||||
{
|
||||
if (option_bool(OPT_LOG_OPTS) || !option_bool(OPT_QUIET_DHCP6))
|
||||
log6_packet(state, type, addr, string);
|
||||
}
|
||||
|
||||
static void log6_packet(struct state *state, char *type, struct in6_addr *addr, char *string)
|
||||
{
|
||||
int clid_len = state->clid_len;
|
||||
|
||||
Reference in New Issue
Block a user