vxlan_private.h (6ab271aaad25351ea8587d67c6837678b875eb2c) vxlan_private.h (a3a48de5eade770e911d35291217bdd69ce04ef1)
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Vxlan private header file
4 *
5 */
6
7#ifndef _VXLAN_PRIVATE_H
8#define _VXLAN_PRIVATE_H

--- 96 unchanged lines hidden (view full) ---

105 const union vxlan_addr *ip)
106{
107 if (ip->sa.sa_family == AF_INET6)
108 return nla_put_in6_addr(skb, attr, &ip->sin6.sin6_addr);
109 else
110 return nla_put_in_addr(skb, attr, ip->sin.sin_addr.s_addr);
111}
112
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Vxlan private header file
4 *
5 */
6
7#ifndef _VXLAN_PRIVATE_H
8#define _VXLAN_PRIVATE_H

--- 96 unchanged lines hidden (view full) ---

105 const union vxlan_addr *ip)
106{
107 if (ip->sa.sa_family == AF_INET6)
108 return nla_put_in6_addr(skb, attr, &ip->sin6.sin6_addr);
109 else
110 return nla_put_in_addr(skb, attr, ip->sin.sin_addr.s_addr);
111}
112
113static inline bool vxlan_addr_is_multicast(const union vxlan_addr *ip)
114{
115 if (ip->sa.sa_family == AF_INET6)
116 return ipv6_addr_is_multicast(&ip->sin6.sin6_addr);
117 else
118 return ipv4_is_multicast(ip->sin.sin_addr.s_addr);
119}
120
113#else /* !CONFIG_IPV6 */
114
115static inline
116bool vxlan_addr_equal(const union vxlan_addr *a, const union vxlan_addr *b)
117{
118 return a->sin.sin_addr.s_addr == b->sin.sin_addr.s_addr;
119}
120

--- 12 unchanged lines hidden (view full) ---

133}
134
135static inline int vxlan_nla_put_addr(struct sk_buff *skb, int attr,
136 const union vxlan_addr *ip)
137{
138 return nla_put_in_addr(skb, attr, ip->sin.sin_addr.s_addr);
139}
140
121#else /* !CONFIG_IPV6 */
122
123static inline
124bool vxlan_addr_equal(const union vxlan_addr *a, const union vxlan_addr *b)
125{
126 return a->sin.sin_addr.s_addr == b->sin.sin_addr.s_addr;
127}
128

--- 12 unchanged lines hidden (view full) ---

141}
142
143static inline int vxlan_nla_put_addr(struct sk_buff *skb, int attr,
144 const union vxlan_addr *ip)
145{
146 return nla_put_in_addr(skb, attr, ip->sin.sin_addr.s_addr);
147}
148
149static inline bool vxlan_addr_is_multicast(const union vxlan_addr *ip)
150{
151 return ipv4_is_multicast(ip->sin.sin_addr.s_addr);
152}
153
141#endif
142
154#endif
155
156static inline size_t vxlan_addr_size(const union vxlan_addr *ip)
157{
158 if (ip->sa.sa_family == AF_INET6)
159 return sizeof(struct in6_addr);
160 else
161 return sizeof(__be32);
162}
163
143static inline struct vxlan_vni_node *
144vxlan_vnifilter_lookup(struct vxlan_dev *vxlan, __be32 vni)
145{
146 struct vxlan_vni_group *vg;
147
148 vg = rcu_dereference_rtnl(vxlan->vnigrp);
149 if (!vg)
150 return NULL;

--- 50 unchanged lines hidden (view full) ---

201int vxlan_multicast_join(struct vxlan_dev *vxlan);
202int vxlan_multicast_leave(struct vxlan_dev *vxlan);
203bool vxlan_group_used(struct vxlan_net *vn, struct vxlan_dev *dev,
204 __be32 vni, union vxlan_addr *rip, int rifindex);
205int vxlan_igmp_join(struct vxlan_dev *vxlan, union vxlan_addr *rip,
206 int rifindex);
207int vxlan_igmp_leave(struct vxlan_dev *vxlan, union vxlan_addr *rip,
208 int rifindex);
164static inline struct vxlan_vni_node *
165vxlan_vnifilter_lookup(struct vxlan_dev *vxlan, __be32 vni)
166{
167 struct vxlan_vni_group *vg;
168
169 vg = rcu_dereference_rtnl(vxlan->vnigrp);
170 if (!vg)
171 return NULL;

--- 50 unchanged lines hidden (view full) ---

222int vxlan_multicast_join(struct vxlan_dev *vxlan);
223int vxlan_multicast_leave(struct vxlan_dev *vxlan);
224bool vxlan_group_used(struct vxlan_net *vn, struct vxlan_dev *dev,
225 __be32 vni, union vxlan_addr *rip, int rifindex);
226int vxlan_igmp_join(struct vxlan_dev *vxlan, union vxlan_addr *rip,
227 int rifindex);
228int vxlan_igmp_leave(struct vxlan_dev *vxlan, union vxlan_addr *rip,
229 int rifindex);
230
231/* vxlan_mdb.c */
232int vxlan_mdb_dump(struct net_device *dev, struct sk_buff *skb,
233 struct netlink_callback *cb);
234int vxlan_mdb_add(struct net_device *dev, struct nlattr *tb[], u16 nlmsg_flags,
235 struct netlink_ext_ack *extack);
236int vxlan_mdb_del(struct net_device *dev, struct nlattr *tb[],
237 struct netlink_ext_ack *extack);
238int vxlan_mdb_init(struct vxlan_dev *vxlan);
239void vxlan_mdb_fini(struct vxlan_dev *vxlan);
209#endif
240#endif