mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-05 18:39:59 +00:00
![Martin KaFai Lau](/assets/img/avatar_default.png)
Similar to the earlier patch that changes sk_getsockopt() to take the sockptr_t argument. This patch also changes do_ip_getsockopt() to take the sockptr_t argument such that a latter patch can make bpf_getsockopt(SOL_IP) to reuse do_ip_getsockopt(). Note on the change in ip_mc_gsfget(). This function is to return an array of sockaddr_storage in optval. This function is shared between ip_get_mcast_msfilter() and compat_ip_get_mcast_msfilter(). However, the sockaddr_storage is stored at different offset of the optval because of the difference between group_filter and compat_group_filter. Thus, a new 'ss_offset' argument is added to ip_mc_gsfget(). Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org> Link: https://lore.kernel.org/r/20220902002828.2890585-1-kafai@fb.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
88 lines
2 KiB
C
88 lines
2 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef __LINUX_MROUTE_H
|
|
#define __LINUX_MROUTE_H
|
|
|
|
#include <linux/in.h>
|
|
#include <linux/pim.h>
|
|
#include <net/fib_rules.h>
|
|
#include <net/fib_notifier.h>
|
|
#include <uapi/linux/mroute.h>
|
|
#include <linux/mroute_base.h>
|
|
#include <linux/sockptr.h>
|
|
|
|
#ifdef CONFIG_IP_MROUTE
|
|
static inline int ip_mroute_opt(int opt)
|
|
{
|
|
return opt >= MRT_BASE && opt <= MRT_MAX;
|
|
}
|
|
|
|
int ip_mroute_setsockopt(struct sock *, int, sockptr_t, unsigned int);
|
|
int ip_mroute_getsockopt(struct sock *, int, sockptr_t, sockptr_t);
|
|
int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg);
|
|
int ipmr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg);
|
|
int ip_mr_init(void);
|
|
bool ipmr_rule_default(const struct fib_rule *rule);
|
|
#else
|
|
static inline int ip_mroute_setsockopt(struct sock *sock, int optname,
|
|
sockptr_t optval, unsigned int optlen)
|
|
{
|
|
return -ENOPROTOOPT;
|
|
}
|
|
|
|
static inline int ip_mroute_getsockopt(struct sock *sk, int optname,
|
|
sockptr_t optval, sockptr_t optlen)
|
|
{
|
|
return -ENOPROTOOPT;
|
|
}
|
|
|
|
static inline int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg)
|
|
{
|
|
return -ENOIOCTLCMD;
|
|
}
|
|
|
|
static inline int ip_mr_init(void)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline int ip_mroute_opt(int opt)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline bool ipmr_rule_default(const struct fib_rule *rule)
|
|
{
|
|
return true;
|
|
}
|
|
#endif
|
|
|
|
#define VIFF_STATIC 0x8000
|
|
|
|
struct mfc_cache_cmp_arg {
|
|
__be32 mfc_mcastgrp;
|
|
__be32 mfc_origin;
|
|
};
|
|
|
|
/**
|
|
* struct mfc_cache - multicast routing entries
|
|
* @_c: Common multicast routing information; has to be first [for casting]
|
|
* @mfc_mcastgrp: destination multicast group address
|
|
* @mfc_origin: source address
|
|
* @cmparg: used for rhashtable comparisons
|
|
*/
|
|
struct mfc_cache {
|
|
struct mr_mfc _c;
|
|
union {
|
|
struct {
|
|
__be32 mfc_mcastgrp;
|
|
__be32 mfc_origin;
|
|
};
|
|
struct mfc_cache_cmp_arg cmparg;
|
|
};
|
|
};
|
|
|
|
struct rtmsg;
|
|
int ipmr_get_route(struct net *net, struct sk_buff *skb,
|
|
__be32 saddr, __be32 daddr,
|
|
struct rtmsg *rtm, u32 portid);
|
|
#endif
|