Skip to content

Commit

Permalink
Change .conf parser, prefix global options
Browse files Browse the repository at this point in the history
Signed-off-by: Joachim Wiberg <[email protected]>
  • Loading branch information
troglobit committed Mar 15, 2024
1 parent 760ef87 commit 0a56c46
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 19 deletions.
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,23 @@ different IGMP/MLD settings per interface at the moment, only protocol
version.

# /etc/mcd.conf syntax
query-interval [1-1024] # default: 125 sec
query-response-interval [1-1024] # default: 10 sec
query-last-member-interval [1-1024] # default: 1
global-query-interval [1-1024] # default: 125 sec
global-response-interval [1-1024] # default: 10 sec
global-last-member-interval [1-1024] # default: 1
robustness [2-10] # default: 2
router-timeout [10-1024] # default: 255 sec

iface IFNAME [enable] [proxy-mode] [igmpv2 | igmpv3] # default: disable
iface IFNAME [enable] # default: disable
[proxy-mode] [igmpv2 | igmpv3]
[query-interval [1-1024]]

Description:

* `query-interval`: the interval between IGMP/MLD queries, when
elected as querier for a LAN
* `query-response-interval`: max response time to a query. Can be
* `global-query-interval`, `query-interval`: the interval between
IGMP/MLD queries, when elected as querier for a LAN
* `global-response-interval`: max response time to a query. Can be
used to control the burstiness of IGMP/MLD traffic
* `query-last-member-interval`: time between group specific queries,
* `global-last-member-interval`: time between group specific queries,
the `robustness` setting controls the number of queries sent
* `robustness`: controls the tolerance to loss of replies from end
devices and the loss of elected queriers (above)
Expand Down
6 changes: 3 additions & 3 deletions mcd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
# By default, mcd is disabled on all interfaces.

# Query interval can be [1,1024], default 125. Recommended not go below 10
#query-interval 125
#global-query-interval 125

# The interval inside the query-interval that clients should respond
#query-response-interval 10
#global-response-interval 10

# Last member query interval [1,1024], default 1. The igmp-robustness
# setting controls the last member query count.
#query-last-member-interval 1
#global-last-member-interval 1

# Querier's robustness can be [2,10], default 2. Recommended to use 2
#robustness 2
Expand Down
14 changes: 8 additions & 6 deletions src/cfparse.y
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ static struct ifi scrap;
uint32_t addr, group;
};

%token QUERY_INTERVAL QUERY_LAST_MEMBER_INTERVAL QUERY_RESPONSE_INTERVAL
%token GLOBAL_QUERY_INTERVAL GLOBAL_QUERY_LAST_MEMBER_INTERVAL GLOBAL_QUERY_RESPONSE_INTERVAL
%token QUERY_INTERVAL
%token IGMP_ROBUSTNESS ROUTER_TIMEOUT ROUTER_ALERT
%token NO PHYINT
%token DISABLE ENABLE IGMPV1 IGMPV2 IGMPV3 STATIC_GROUP PROXY_QUERIER
Expand Down Expand Up @@ -90,19 +91,19 @@ stmt : error
fatal("Invalid multicast router timeout [1,1024]: %d", $2);
router_timeout = $2;
}
| QUERY_INTERVAL NUMBER
| GLOBAL_QUERY_INTERVAL NUMBER
{
if ($2 < 1 || $2 > 1024)
fatal("Invalid multicast query interval [1,1024]: %d", $2);
igmp_query_interval = $2;
}
| QUERY_RESPONSE_INTERVAL NUMBER
| GLOBAL_QUERY_RESPONSE_INTERVAL NUMBER
{
if ($2 < 1 || $2 > 1024)
fatal("Invalid multicast query response interval [1,1024]: %d", $2);
igmp_response_interval = $2;
}
| QUERY_LAST_MEMBER_INTERVAL NUMBER
| GLOBAL_QUERY_LAST_MEMBER_INTERVAL NUMBER
{
if ($2 < 1 || $2 > 1024)
fatal("Invalid multicast query interval [1,1024]: %d", $2);
Expand Down Expand Up @@ -235,9 +236,10 @@ static struct keyword {
int val1;
int val2;
} words[] = {
{ "global-query-interval", GLOBAL_QUERY_INTERVAL, 0 },
{ "global-response-interval", GLOBAL_QUERY_RESPONSE_INTERVAL, 0 },
{ "global-last-member-interval", GLOBAL_QUERY_LAST_MEMBER_INTERVAL, 0 },
{ "query-interval", QUERY_INTERVAL, 0 },
{ "query-response-interval", QUERY_RESPONSE_INTERVAL, 0 },
{ "query-last-member-interval", QUERY_LAST_MEMBER_INTERVAL, 0 },
{ "robustness", IGMP_ROBUSTNESS, 0 },
{ "router-timeout", ROUTER_TIMEOUT, 0 },
{ "no", NO, 0 },
Expand Down
2 changes: 1 addition & 1 deletion test/sleepy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ ip -br a

print "Creating config ..."
cat <<EOF > "/tmp/$NM/config"
query-interval 5
global-query-interval 5
iface eth0 enable igmpv3
iface eth1 enable igmpv3
iface eth2 enable igmpv3
Expand Down
2 changes: 1 addition & 1 deletion test/two.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ ip -br a

print "Creating config ..."
cat <<EOF > "/tmp/$NM/config"
query-interval 5
global-query-interval 5
iface eth0 enable igmpv3
iface eth1 enable igmpv3
EOF
Expand Down

0 comments on commit 0a56c46

Please sign in to comment.