History

bridge: netlink: add support for igmp's intervals

Add support to set/get all of the igmp's configurable intervals via netlink. These currently are: IFLA_BR_MCAST_LAST_MEMBER_INTVL IFLA_BR_MCAST_MEMBERSHIP_INTVL IFLA_BR_MCAST_QUERIER_INTVL IFLA_BR_MCAST_QUERY_INTVL IFLA_BR_MCAST_QUERY_RESPONSE_INTVL IFLA_BR_MCAST_STARTUP_QUERY_INTVL

Nikolay Aleksandrov committed 11 years ago

Commit 7e4df511 parent b89e6ba2 files · +75 −1Browse files

Unified · Split

2 files
  1. include/uapi/linux/if_link.h +6 −0
  2. net/bridge/br_netlink.c +69 −1
include/uapi/linux/if_link.h+6−0
@@ -253,6 +253,12 @@ enum { · 252 unmodified lines
253 IFLA_BR_MCAST_HASH_MAX,253 IFLA_BR_MCAST_HASH_MAX,
254 IFLA_BR_MCAST_LAST_MEMBER_CNT,254 IFLA_BR_MCAST_LAST_MEMBER_CNT,
255 IFLA_BR_MCAST_STARTUP_QUERY_CNT,255 IFLA_BR_MCAST_STARTUP_QUERY_CNT,
256 IFLA_BR_MCAST_LAST_MEMBER_INTVL,
257 IFLA_BR_MCAST_MEMBERSHIP_INTVL,
258 IFLA_BR_MCAST_QUERIER_INTVL,
259 IFLA_BR_MCAST_QUERY_INTVL,
260 IFLA_BR_MCAST_QUERY_RESPONSE_INTVL,
261 IFLA_BR_MCAST_STARTUP_QUERY_INTVL,
256 __IFLA_BR_MAX,262 __IFLA_BR_MAX,
257};263};
258 264
net/bridge/br_netlink.c+69−1
@@ -775,6 +775,12 @@ static const struct nla_policy br_policy[IFLA_BR_MAX + 1] = { · 774 unmodified lines
775 [IFLA_BR_MCAST_HASH_MAX] = { .type = NLA_U32 },775 [IFLA_BR_MCAST_HASH_MAX] = { .type = NLA_U32 },
776 [IFLA_BR_MCAST_LAST_MEMBER_CNT] = { .type = NLA_U32 },776 [IFLA_BR_MCAST_LAST_MEMBER_CNT] = { .type = NLA_U32 },
777 [IFLA_BR_MCAST_STARTUP_QUERY_CNT] = { .type = NLA_U32 },777 [IFLA_BR_MCAST_STARTUP_QUERY_CNT] = { .type = NLA_U32 },
778 [IFLA_BR_MCAST_LAST_MEMBER_INTVL] = { .type = NLA_U64 },
779 [IFLA_BR_MCAST_MEMBERSHIP_INTVL] = { .type = NLA_U64 },
780 [IFLA_BR_MCAST_QUERIER_INTVL] = { .type = NLA_U64 },
781 [IFLA_BR_MCAST_QUERY_INTVL] = { .type = NLA_U64 },
782 [IFLA_BR_MCAST_QUERY_RESPONSE_INTVL] = { .type = NLA_U64 },
783 [IFLA_BR_MCAST_STARTUP_QUERY_INTVL] = { .type = NLA_U64 },
778};784};
779 785
780static int br_changelink(struct net_device *brdev, struct nlattr *tb[],786static int br_changelink(struct net_device *brdev, struct nlattr *tb[],
@@ -927,6 +933,42 @@ static int br_changelink(struct net_device *brdev, struct nlattr *tb[], · 146 unmodified lines
927 933
928 br->multicast_startup_query_count = val;934 br->multicast_startup_query_count = val;
929 }935 }
936
937 if (data[IFLA_BR_MCAST_LAST_MEMBER_INTVL]) {
938 u64 val = nla_get_u64(data[IFLA_BR_MCAST_LAST_MEMBER_INTVL]);
939
940 br->multicast_last_member_interval = clock_t_to_jiffies(val);
941 }
942
943 if (data[IFLA_BR_MCAST_MEMBERSHIP_INTVL]) {
944 u64 val = nla_get_u64(data[IFLA_BR_MCAST_MEMBERSHIP_INTVL]);
945
946 br->multicast_membership_interval = clock_t_to_jiffies(val);
947 }
948
949 if (data[IFLA_BR_MCAST_QUERIER_INTVL]) {
950 u64 val = nla_get_u64(data[IFLA_BR_MCAST_QUERIER_INTVL]);
951
952 br->multicast_querier_interval = clock_t_to_jiffies(val);
953 }
954
955 if (data[IFLA_BR_MCAST_QUERY_INTVL]) {
956 u64 val = nla_get_u64(data[IFLA_BR_MCAST_QUERY_INTVL]);
957
958 br->multicast_query_interval = clock_t_to_jiffies(val);
959 }
960
961 if (data[IFLA_BR_MCAST_QUERY_RESPONSE_INTVL]) {
962 u64 val = nla_get_u64(data[IFLA_BR_MCAST_QUERY_RESPONSE_INTVL]);
963
964 br->multicast_query_response_interval = clock_t_to_jiffies(val);
965 }
966
967 if (data[IFLA_BR_MCAST_STARTUP_QUERY_INTVL]) {
968 u64 val = nla_get_u64(data[IFLA_BR_MCAST_STARTUP_QUERY_INTVL]);
969
970 br->multicast_startup_query_interval = clock_t_to_jiffies(val);
971 }
930#endif972#endif
931 973
932 return 0;974 return 0;
@@ -965,6 +1007,12 @@ static size_t br_get_size(const struct net_device *brdev) · 32 unmodified lines
965 nla_total_size(sizeof(u32)) + /* IFLA_BR_MCAST_HASH_MAX */1007 nla_total_size(sizeof(u32)) + /* IFLA_BR_MCAST_HASH_MAX */
966 nla_total_size(sizeof(u32)) + /* IFLA_BR_MCAST_LAST_MEMBER_CNT */1008 nla_total_size(sizeof(u32)) + /* IFLA_BR_MCAST_LAST_MEMBER_CNT */
967 nla_total_size(sizeof(u32)) + /* IFLA_BR_MCAST_STARTUP_QUERY_CNT */1009 nla_total_size(sizeof(u32)) + /* IFLA_BR_MCAST_STARTUP_QUERY_CNT */
1010 nla_total_size(sizeof(u64)) + /* IFLA_BR_MCAST_LAST_MEMBER_INTVL */
1011 nla_total_size(sizeof(u64)) + /* IFLA_BR_MCAST_MEMBERSHIP_INTVL */
1012 nla_total_size(sizeof(u64)) + /* IFLA_BR_MCAST_QUERIER_INTVL */
1013 nla_total_size(sizeof(u64)) + /* IFLA_BR_MCAST_QUERY_INTVL */
1014 nla_total_size(sizeof(u64)) + /* IFLA_BR_MCAST_QUERY_RESPONSE_INTVL */
1015 nla_total_size(sizeof(u64)) + /* IFLA_BR_MCAST_STARTUP_QUERY_INTVL */
968#endif1016#endif
969 0;1017 0;
970}1018}
@@ -972,7 +1020,7 @@ static size_t br_get_size(const struct net_device *brdev) · 1 unmodified line
972static int br_fill_info(struct sk_buff *skb, const struct net_device *brdev)1020static int br_fill_info(struct sk_buff *skb, const struct net_device *brdev)
973{1021{
974 struct net_bridge *br = netdev_priv(brdev);1022 struct net_bridge *br = netdev_priv(brdev);
975 u64 hello_timer, tcn_timer, topology_change_timer, gc_timer;1023 u64 hello_timer, tcn_timer, topology_change_timer, gc_timer, clockval;
976 u32 forward_delay = jiffies_to_clock_t(br->forward_delay);1024 u32 forward_delay = jiffies_to_clock_t(br->forward_delay);
977 u32 hello_time = jiffies_to_clock_t(br->hello_time);1025 u32 hello_time = jiffies_to_clock_t(br->hello_time);
978 u32 age_time = jiffies_to_clock_t(br->max_age);1026 u32 age_time = jiffies_to_clock_t(br->max_age);
@@ -993,6 +1041,7 @@ static int br_fill_info(struct sk_buff *skb, const struct net_device *brdev) · 14 unmodified lines
993 tcn_timer = br_timer_value(&br->tcn_timer);1041 tcn_timer = br_timer_value(&br->tcn_timer);
994 topology_change_timer = br_timer_value(&br->topology_change_timer);1042 topology_change_timer = br_timer_value(&br->topology_change_timer);
995 gc_timer = br_timer_value(&br->gc_timer);1043 gc_timer = br_timer_value(&br->gc_timer);
1044 clockval = 0;
996 1045
997 if (nla_put_u32(skb, IFLA_BR_FORWARD_DELAY, forward_delay) ||1046 if (nla_put_u32(skb, IFLA_BR_FORWARD_DELAY, forward_delay) ||
998 nla_put_u32(skb, IFLA_BR_HELLO_TIME, hello_time) ||1047 nla_put_u32(skb, IFLA_BR_HELLO_TIME, hello_time) ||
@@ -1036,6 +1085,25 @@ static int br_fill_info(struct sk_buff *skb, const struct net_device *brdev) · 37 unmodified lines
1036 nla_put_u32(skb, IFLA_BR_MCAST_STARTUP_QUERY_CNT,1085 nla_put_u32(skb, IFLA_BR_MCAST_STARTUP_QUERY_CNT,
1037 br->multicast_startup_query_count))1086 br->multicast_startup_query_count))
1038 return -EMSGSIZE;1087 return -EMSGSIZE;
1088
1089 clockval = jiffies_to_clock_t(br->multicast_last_member_interval);
1090 if (nla_put_u64(skb, IFLA_BR_MCAST_LAST_MEMBER_INTVL, clockval))
1091 return -EMSGSIZE;
1092 clockval = jiffies_to_clock_t(br->multicast_membership_interval);
1093 if (nla_put_u64(skb, IFLA_BR_MCAST_MEMBERSHIP_INTVL, clockval))
1094 return -EMSGSIZE;
1095 clockval = jiffies_to_clock_t(br->multicast_querier_interval);
1096 if (nla_put_u64(skb, IFLA_BR_MCAST_QUERIER_INTVL, clockval))
1097 return -EMSGSIZE;
1098 clockval = jiffies_to_clock_t(br->multicast_query_interval);
1099 if (nla_put_u64(skb, IFLA_BR_MCAST_QUERY_INTVL, clockval))
1100 return -EMSGSIZE;
1101 clockval = jiffies_to_clock_t(br->multicast_query_response_interval);
1102 if (nla_put_u64(skb, IFLA_BR_MCAST_QUERY_RESPONSE_INTVL, clockval))
1103 return -EMSGSIZE;
1104 clockval = jiffies_to_clock_t(br->multicast_startup_query_interval);
1105 if (nla_put_u64(skb, IFLA_BR_MCAST_STARTUP_QUERY_INTVL, clockval))
1106 return -EMSGSIZE;
1039#endif1107#endif
1040 1108
1041 return 0;1109 return 0;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t