1 /* SPDX-License-Identifier: GPL-2.0 */ 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* Copyright (C) B.A.T.M.A.N. contributors: 2 /* Copyright (C) B.A.T.M.A.N. contributors: 3 * 3 * 4 * Linus Lüssing 4 * Linus Lüssing 5 */ 5 */ 6 6 7 #ifndef _NET_BATMAN_ADV_MULTICAST_H_ 7 #ifndef _NET_BATMAN_ADV_MULTICAST_H_ 8 #define _NET_BATMAN_ADV_MULTICAST_H_ 8 #define _NET_BATMAN_ADV_MULTICAST_H_ 9 9 10 #include "main.h" 10 #include "main.h" 11 11 12 #include <linux/netlink.h> 12 #include <linux/netlink.h> 13 #include <linux/skbuff.h> 13 #include <linux/skbuff.h> 14 #include <linux/types.h> 14 #include <linux/types.h> 15 15 16 /** 16 /** 17 * enum batadv_forw_mode - the way a packet sh 17 * enum batadv_forw_mode - the way a packet should be forwarded as 18 */ 18 */ 19 enum batadv_forw_mode { 19 enum batadv_forw_mode { 20 /** 20 /** 21 * @BATADV_FORW_BCAST: forward the pac 21 * @BATADV_FORW_BCAST: forward the packet to all nodes via a batman-adv 22 * broadcast packet 22 * broadcast packet 23 */ 23 */ 24 BATADV_FORW_BCAST, 24 BATADV_FORW_BCAST, 25 25 26 /** 26 /** 27 * @BATADV_FORW_UCASTS: forward the pa 27 * @BATADV_FORW_UCASTS: forward the packet to some nodes via one 28 * or more batman-adv unicast packets 28 * or more batman-adv unicast packets 29 */ 29 */ 30 BATADV_FORW_UCASTS, 30 BATADV_FORW_UCASTS, 31 31 32 /** 32 /** 33 * @BATADV_FORW_MCAST: forward the pac 33 * @BATADV_FORW_MCAST: forward the packet to some nodes via a 34 * batman-adv multicast packet 34 * batman-adv multicast packet 35 */ 35 */ 36 BATADV_FORW_MCAST, 36 BATADV_FORW_MCAST, 37 37 38 /** @BATADV_FORW_NONE: don't forward, 38 /** @BATADV_FORW_NONE: don't forward, drop it */ 39 BATADV_FORW_NONE, 39 BATADV_FORW_NONE, 40 }; 40 }; 41 41 42 #ifdef CONFIG_BATMAN_ADV_MCAST 42 #ifdef CONFIG_BATMAN_ADV_MCAST 43 43 44 enum batadv_forw_mode 44 enum batadv_forw_mode 45 batadv_mcast_forw_mode(struct batadv_priv *bat 45 batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb, 46 unsigned short vid, int 46 unsigned short vid, int *is_routable); 47 47 48 int batadv_mcast_forw_send(struct batadv_priv 48 int batadv_mcast_forw_send(struct batadv_priv *bat_priv, struct sk_buff *skb, 49 unsigned short vid, 49 unsigned short vid, int is_routable); 50 50 51 void batadv_mcast_init(struct batadv_priv *bat 51 void batadv_mcast_init(struct batadv_priv *bat_priv); 52 52 53 int batadv_mcast_mesh_info_put(struct sk_buff 53 int batadv_mcast_mesh_info_put(struct sk_buff *msg, 54 struct batadv_p 54 struct batadv_priv *bat_priv); 55 55 56 int batadv_mcast_flags_dump(struct sk_buff *ms 56 int batadv_mcast_flags_dump(struct sk_buff *msg, struct netlink_callback *cb); 57 57 58 void batadv_mcast_free(struct batadv_priv *bat 58 void batadv_mcast_free(struct batadv_priv *bat_priv); 59 59 60 void batadv_mcast_purge_orig(struct batadv_ori 60 void batadv_mcast_purge_orig(struct batadv_orig_node *orig_node); 61 61 62 /* multicast_forw.c */ 62 /* multicast_forw.c */ 63 63 64 int batadv_mcast_forw_tracker_tvlv_handler(str 64 int batadv_mcast_forw_tracker_tvlv_handler(struct batadv_priv *bat_priv, 65 str 65 struct sk_buff *skb); 66 66 67 unsigned int batadv_mcast_forw_packet_hdrlen(u 67 unsigned int batadv_mcast_forw_packet_hdrlen(unsigned int num_dests); 68 68 69 bool batadv_mcast_forw_push(struct batadv_priv 69 bool batadv_mcast_forw_push(struct batadv_priv *bat_priv, struct sk_buff *skb, 70 unsigned short vid 70 unsigned short vid, int is_routable, int count); 71 71 72 int batadv_mcast_forw_mcsend(struct batadv_pri 72 int batadv_mcast_forw_mcsend(struct batadv_priv *bat_priv, struct sk_buff *skb); 73 73 74 #else 74 #else 75 75 76 static inline enum batadv_forw_mode 76 static inline enum batadv_forw_mode 77 batadv_mcast_forw_mode(struct batadv_priv *bat 77 batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb, 78 unsigned short vid, int 78 unsigned short vid, int *is_routable) 79 { 79 { 80 return BATADV_FORW_BCAST; 80 return BATADV_FORW_BCAST; 81 } 81 } 82 82 83 static inline int 83 static inline int 84 batadv_mcast_forw_send(struct batadv_priv *bat 84 batadv_mcast_forw_send(struct batadv_priv *bat_priv, struct sk_buff *skb, 85 unsigned short vid, int 85 unsigned short vid, int is_routable) 86 { 86 { 87 kfree_skb(skb); 87 kfree_skb(skb); 88 return NET_XMIT_DROP; 88 return NET_XMIT_DROP; 89 } 89 } 90 90 91 static inline int batadv_mcast_init(struct bat 91 static inline int batadv_mcast_init(struct batadv_priv *bat_priv) 92 { 92 { 93 return 0; 93 return 0; 94 } 94 } 95 95 96 static inline int 96 static inline int 97 batadv_mcast_mesh_info_put(struct sk_buff *msg 97 batadv_mcast_mesh_info_put(struct sk_buff *msg, struct batadv_priv *bat_priv) 98 { 98 { 99 return 0; 99 return 0; 100 } 100 } 101 101 102 static inline int batadv_mcast_flags_dump(stru 102 static inline int batadv_mcast_flags_dump(struct sk_buff *msg, 103 stru 103 struct netlink_callback *cb) 104 { 104 { 105 return -EOPNOTSUPP; 105 return -EOPNOTSUPP; 106 } 106 } 107 107 108 static inline void batadv_mcast_free(struct ba 108 static inline void batadv_mcast_free(struct batadv_priv *bat_priv) 109 { 109 { 110 } 110 } 111 111 112 static inline void batadv_mcast_purge_orig(str 112 static inline void batadv_mcast_purge_orig(struct batadv_orig_node *orig_node) 113 { 113 { 114 } 114 } 115 115 116 static inline int batadv_mcast_forw_mcsend(str 116 static inline int batadv_mcast_forw_mcsend(struct batadv_priv *bat_priv, 117 str 117 struct sk_buff *skb) 118 { 118 { 119 kfree_skb(skb); 119 kfree_skb(skb); 120 return NET_XMIT_DROP; 120 return NET_XMIT_DROP; 121 } 121 } 122 122 123 #endif /* CONFIG_BATMAN_ADV_MCAST */ 123 #endif /* CONFIG_BATMAN_ADV_MCAST */ 124 124 125 #endif /* _NET_BATMAN_ADV_MULTICAST_H_ */ 125 #endif /* _NET_BATMAN_ADV_MULTICAST_H_ */ 126 126
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.