linux/net/ipv6/raw.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *	RAW sockets for IPv6
 *	Linux INET6 implementation
 *
 *	Authors:
 *	Pedro Roque		<[email protected]>
 *
 *	Adapted from linux/net/ipv4/raw.c
 *
 *	Fixes:
 *	Hideaki YOSHIFUJI	:	sin6_scope_id support
 *	YOSHIFUJI,H.@USAGI	:	raw checksum (RFC2292(bis) compliance)
 *	Kazunori MIYAZAWA @USAGI:	change process style to use ip6_append_data
 */

#include <linux/errno.h>
#include <linux/types.h>
#include <linux/socket.h>
#include <linux/slab.h>
#include <linux/sockios.h>
#include <linux/net.h>
#include <linux/in6.h>
#include <linux/netdevice.h>
#include <linux/if_arp.h>
#include <linux/icmpv6.h>
#include <linux/netfilter.h>
#include <linux/netfilter_ipv6.h>
#include <linux/skbuff.h>
#include <linux/compat.h>
#include <linux/uaccess.h>
#include <asm/ioctls.h>

#include <net/net_namespace.h>
#include <net/ip.h>
#include <net/sock.h>
#include <net/snmp.h>

#include <net/ipv6.h>
#include <net/ndisc.h>
#include <net/protocol.h>
#include <net/ip6_route.h>
#include <net/ip6_checksum.h>
#include <net/addrconf.h>
#include <net/transp_v6.h>
#include <net/udp.h>
#include <net/inet_common.h>
#include <net/tcp_states.h>
#if IS_ENABLED(CONFIG_IPV6_MIP6)
#include <net/mip6.h>
#endif
#include <linux/mroute6.h>

#include <net/raw.h>
#include <net/rawv6.h>
#include <net/xfrm.h>

#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/export.h>

#define ICMPV6_HDRLEN

struct raw_hashinfo raw_v6_hashinfo;
EXPORT_SYMBOL_GPL();

bool raw_v6_match(struct net *net, const struct sock *sk, unsigned short num,
		  const struct in6_addr *loc_addr,
		  const struct in6_addr *rmt_addr, int dif, int sdif)
{}
EXPORT_SYMBOL_GPL();

/*
 *	0 - deliver
 *	1 - block
 */
static int icmpv6_filter(const struct sock *sk, const struct sk_buff *skb)
{}

#if IS_ENABLED(CONFIG_IPV6_MIP6)
mh_filter_t;

static mh_filter_t __rcu *mh_filter __read_mostly;

int rawv6_mh_filter_register(mh_filter_t filter)
{}
EXPORT_SYMBOL();

int rawv6_mh_filter_unregister(mh_filter_t filter)
{}
EXPORT_SYMBOL();

#endif

/*
 *	demultiplex raw sockets.
 *	(should consider queueing the skb in the sock receive_queue
 *	without calling rawv6.c)
 *
 *	Caller owns SKB so we must make clones.
 */
static bool ipv6_raw_deliver(struct sk_buff *skb, int nexthdr)
{}

bool raw6_local_deliver(struct sk_buff *skb, int nexthdr)
{}

/* This cleans up af_inet6 a bit. -DaveM */
static int rawv6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
{}

static void rawv6_err(struct sock *sk, struct sk_buff *skb,
		      u8 type, u8 code, int offset, __be32 info)
{}

void raw6_icmp_error(struct sk_buff *skb, int nexthdr,
		u8 type, u8 code, int inner_offset, __be32 info)
{}

static inline int rawv6_rcv_skb(struct sock *sk, struct sk_buff *skb)
{}

/*
 *	This is next to useless...
 *	if we demultiplex in network layer we don't need the extra call
 *	just to queue the skb...
 *	maybe we could have the network decide upon a hint if it
 *	should call raw_rcv for demultiplexing
 */
int rawv6_rcv(struct sock *sk, struct sk_buff *skb)
{}


/*
 *	This should be easy, if there is something there
 *	we return it, otherwise we block.
 */

static int rawv6_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
			 int flags, int *addr_len)
{}

static int rawv6_push_pending_frames(struct sock *sk, struct flowi6 *fl6,
				     struct raw6_sock *rp)
{}

static int rawv6_send_hdrinc(struct sock *sk, struct msghdr *msg, int length,
			struct flowi6 *fl6, struct dst_entry **dstp,
			unsigned int flags, const struct sockcm_cookie *sockc)
{}

struct raw6_frag_vec {};

static int rawv6_probe_proto_opt(struct raw6_frag_vec *rfv, struct flowi6 *fl6)
{}

static int raw6_getfrag(void *from, char *to, int offset, int len, int odd,
		       struct sk_buff *skb)
{}

static int rawv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
{}

static int rawv6_seticmpfilter(struct sock *sk, int optname,
			       sockptr_t optval, int optlen)
{}

static int rawv6_geticmpfilter(struct sock *sk, int optname,
			       char __user *optval, int __user *optlen)
{}


static int do_rawv6_setsockopt(struct sock *sk, int level, int optname,
			       sockptr_t optval, unsigned int optlen)
{}

static int rawv6_setsockopt(struct sock *sk, int level, int optname,
			    sockptr_t optval, unsigned int optlen)
{}

static int do_rawv6_getsockopt(struct sock *sk, int level, int optname,
			    char __user *optval, int __user *optlen)
{}

static int rawv6_getsockopt(struct sock *sk, int level, int optname,
			  char __user *optval, int __user *optlen)
{}

static int rawv6_ioctl(struct sock *sk, int cmd, int *karg)
{}

#ifdef CONFIG_COMPAT
static int compat_rawv6_ioctl(struct sock *sk, unsigned int cmd, unsigned long arg)
{}
#endif

static void rawv6_close(struct sock *sk, long timeout)
{}

static void raw6_destroy(struct sock *sk)
{}

static int rawv6_init_sk(struct sock *sk)
{}

struct proto rawv6_prot =;

#ifdef CONFIG_PROC_FS
static int raw6_seq_show(struct seq_file *seq, void *v)
{}

static const struct seq_operations raw6_seq_ops =;

static int __net_init raw6_init_net(struct net *net)
{}

static void __net_exit raw6_exit_net(struct net *net)
{}

static struct pernet_operations raw6_net_ops =;

int __init raw6_proc_init(void)
{}

void raw6_proc_exit(void)
{}
#endif	/* CONFIG_PROC_FS */

/* Same as inet6_dgram_ops, sans udp_poll.  */
const struct proto_ops inet6_sockraw_ops =;

static struct inet_protosw rawv6_protosw =;

int __init rawv6_init(void)
{}

void rawv6_exit(void)
{}