multicast.c (72f7b2deafde895012f93fa4827d4b1307a138e9) | multicast.c (ba412080fb6461b5a40dbc5e44186ed029d67b8d) |
---|---|
1/* Copyright (C) 2014-2016 B.A.T.M.A.N. contributors: 2 * 3 * Linus Lüssing 4 * 5 * This program is free software; you can redistribute it and/or 6 * modify it under the terms of version 2 of the GNU General Public 7 * License as published by the Free Software Foundation. 8 * --- 27 unchanged lines hidden (view full) --- 36#include <linux/kernel.h> 37#include <linux/kref.h> 38#include <linux/list.h> 39#include <linux/lockdep.h> 40#include <linux/netdevice.h> 41#include <linux/printk.h> 42#include <linux/rculist.h> 43#include <linux/rcupdate.h> | 1/* Copyright (C) 2014-2016 B.A.T.M.A.N. contributors: 2 * 3 * Linus Lüssing 4 * 5 * This program is free software; you can redistribute it and/or 6 * modify it under the terms of version 2 of the GNU General Public 7 * License as published by the Free Software Foundation. 8 * --- 27 unchanged lines hidden (view full) --- 36#include <linux/kernel.h> 37#include <linux/kref.h> 38#include <linux/list.h> 39#include <linux/lockdep.h> 40#include <linux/netdevice.h> 41#include <linux/printk.h> 42#include <linux/rculist.h> 43#include <linux/rcupdate.h> |
44#include <linux/seq_file.h> |
|
44#include <linux/skbuff.h> 45#include <linux/slab.h> 46#include <linux/spinlock.h> 47#include <linux/stddef.h> 48#include <linux/string.h> 49#include <linux/types.h> 50#include <net/addrconf.h> 51#include <net/if_inet6.h> 52#include <net/ip.h> 53#include <net/ipv6.h> 54 | 45#include <linux/skbuff.h> 46#include <linux/slab.h> 47#include <linux/spinlock.h> 48#include <linux/stddef.h> 49#include <linux/string.h> 50#include <linux/types.h> 51#include <net/addrconf.h> 52#include <net/if_inet6.h> 53#include <net/ip.h> 54#include <net/ipv6.h> 55 |
56#include "hard-interface.h" 57#include "hash.h" 58#include "log.h" |
|
55#include "packet.h" 56#include "translation-table.h" | 59#include "packet.h" 60#include "translation-table.h" |
61#include "tvlv.h" |
|
57 58/** 59 * batadv_mcast_get_bridge - get the bridge on top of the softif if it exists 60 * @soft_iface: netdev struct of the mesh interface 61 * 62 * If the given soft interface has a bridge on top then the refcount 63 * of the according net device is increased. 64 * --- 1060 unchanged lines hidden (view full) --- 1125void batadv_mcast_init(struct batadv_priv *bat_priv) 1126{ 1127 batadv_tvlv_handler_register(bat_priv, batadv_mcast_tvlv_ogm_handler, 1128 NULL, BATADV_TVLV_MCAST, 2, 1129 BATADV_TVLV_HANDLER_OGM_CIFNOTFND); 1130} 1131 1132/** | 62 63/** 64 * batadv_mcast_get_bridge - get the bridge on top of the softif if it exists 65 * @soft_iface: netdev struct of the mesh interface 66 * 67 * If the given soft interface has a bridge on top then the refcount 68 * of the according net device is increased. 69 * --- 1060 unchanged lines hidden (view full) --- 1130void batadv_mcast_init(struct batadv_priv *bat_priv) 1131{ 1132 batadv_tvlv_handler_register(bat_priv, batadv_mcast_tvlv_ogm_handler, 1133 NULL, BATADV_TVLV_MCAST, 2, 1134 BATADV_TVLV_HANDLER_OGM_CIFNOTFND); 1135} 1136 1137/** |
1138 * batadv_mcast_flags_print_header - print own mcast flags to debugfs table 1139 * @bat_priv: the bat priv with all the soft interface information 1140 * @seq: debugfs table seq_file struct 1141 * 1142 * Prints our own multicast flags including a more specific reason why 1143 * they are set, that is prints the bridge and querier state too, to 1144 * the debugfs table specified via @seq. 1145 */ 1146static void batadv_mcast_flags_print_header(struct batadv_priv *bat_priv, 1147 struct seq_file *seq) 1148{ 1149 u8 flags = bat_priv->mcast.flags; 1150 char querier4, querier6, shadowing4, shadowing6; 1151 bool bridged = bat_priv->mcast.bridged; 1152 1153 if (bridged) { 1154 querier4 = bat_priv->mcast.querier_ipv4.exists ? '.' : '4'; 1155 querier6 = bat_priv->mcast.querier_ipv6.exists ? '.' : '6'; 1156 shadowing4 = bat_priv->mcast.querier_ipv4.shadowing ? '4' : '.'; 1157 shadowing6 = bat_priv->mcast.querier_ipv6.shadowing ? '6' : '.'; 1158 } else { 1159 querier4 = '?'; 1160 querier6 = '?'; 1161 shadowing4 = '?'; 1162 shadowing6 = '?'; 1163 } 1164 1165 seq_printf(seq, "Multicast flags (own flags: [%c%c%c])\n", 1166 (flags & BATADV_MCAST_WANT_ALL_UNSNOOPABLES) ? 'U' : '.', 1167 (flags & BATADV_MCAST_WANT_ALL_IPV4) ? '4' : '.', 1168 (flags & BATADV_MCAST_WANT_ALL_IPV6) ? '6' : '.'); 1169 seq_printf(seq, "* Bridged [U]\t\t\t\t%c\n", bridged ? 'U' : '.'); 1170 seq_printf(seq, "* No IGMP/MLD Querier [4/6]:\t\t%c/%c\n", 1171 querier4, querier6); 1172 seq_printf(seq, "* Shadowing IGMP/MLD Querier [4/6]:\t%c/%c\n", 1173 shadowing4, shadowing6); 1174 seq_puts(seq, "-------------------------------------------\n"); 1175 seq_printf(seq, " %-10s %s\n", "Originator", "Flags"); 1176} 1177 1178/** 1179 * batadv_mcast_flags_seq_print_text - print the mcast flags of other nodes 1180 * @seq: seq file to print on 1181 * @offset: not used 1182 * 1183 * This prints a table of (primary) originators and their according 1184 * multicast flags, including (in the header) our own. 1185 * 1186 * Return: always 0 1187 */ 1188int batadv_mcast_flags_seq_print_text(struct seq_file *seq, void *offset) 1189{ 1190 struct net_device *net_dev = (struct net_device *)seq->private; 1191 struct batadv_priv *bat_priv = netdev_priv(net_dev); 1192 struct batadv_hard_iface *primary_if; 1193 struct batadv_hashtable *hash = bat_priv->orig_hash; 1194 struct batadv_orig_node *orig_node; 1195 struct hlist_head *head; 1196 u8 flags; 1197 u32 i; 1198 1199 primary_if = batadv_seq_print_text_primary_if_get(seq); 1200 if (!primary_if) 1201 return 0; 1202 1203 batadv_mcast_flags_print_header(bat_priv, seq); 1204 1205 for (i = 0; i < hash->size; i++) { 1206 head = &hash->table[i]; 1207 1208 rcu_read_lock(); 1209 hlist_for_each_entry_rcu(orig_node, head, hash_entry) { 1210 if (!test_bit(BATADV_ORIG_CAPA_HAS_MCAST, 1211 &orig_node->capa_initialized)) 1212 continue; 1213 1214 if (!test_bit(BATADV_ORIG_CAPA_HAS_MCAST, 1215 &orig_node->capabilities)) { 1216 seq_printf(seq, "%pM -\n", orig_node->orig); 1217 continue; 1218 } 1219 1220 flags = orig_node->mcast_flags; 1221 1222 seq_printf(seq, "%pM [%c%c%c]\n", orig_node->orig, 1223 (flags & BATADV_MCAST_WANT_ALL_UNSNOOPABLES) 1224 ? 'U' : '.', 1225 (flags & BATADV_MCAST_WANT_ALL_IPV4) 1226 ? '4' : '.', 1227 (flags & BATADV_MCAST_WANT_ALL_IPV6) 1228 ? '6' : '.'); 1229 } 1230 rcu_read_unlock(); 1231 } 1232 1233 batadv_hardif_put(primary_if); 1234 1235 return 0; 1236} 1237 1238/** |
|
1133 * batadv_mcast_free - free the multicast optimizations structures 1134 * @bat_priv: the bat priv with all the soft interface information 1135 */ 1136void batadv_mcast_free(struct batadv_priv *bat_priv) 1137{ 1138 batadv_tvlv_container_unregister(bat_priv, BATADV_TVLV_MCAST, 2); 1139 batadv_tvlv_handler_unregister(bat_priv, BATADV_TVLV_MCAST, 2); 1140 --- 25 unchanged lines hidden --- | 1239 * batadv_mcast_free - free the multicast optimizations structures 1240 * @bat_priv: the bat priv with all the soft interface information 1241 */ 1242void batadv_mcast_free(struct batadv_priv *bat_priv) 1243{ 1244 batadv_tvlv_container_unregister(bat_priv, BATADV_TVLV_MCAST, 2); 1245 batadv_tvlv_handler_unregister(bat_priv, BATADV_TVLV_MCAST, 2); 1246 --- 25 unchanged lines hidden --- |