cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

mroute6.h (2466B)


      1/* SPDX-License-Identifier: GPL-2.0 */
      2#ifndef __LINUX_MROUTE6_H
      3#define __LINUX_MROUTE6_H
      4
      5
      6#include <linux/pim.h>
      7#include <linux/skbuff.h>	/* for struct sk_buff_head */
      8#include <net/net_namespace.h>
      9#include <uapi/linux/mroute6.h>
     10#include <linux/mroute_base.h>
     11#include <linux/sockptr.h>
     12#include <net/fib_rules.h>
     13
     14#ifdef CONFIG_IPV6_MROUTE
     15static inline int ip6_mroute_opt(int opt)
     16{
     17	return (opt >= MRT6_BASE) && (opt <= MRT6_MAX);
     18}
     19#else
     20static inline int ip6_mroute_opt(int opt)
     21{
     22	return 0;
     23}
     24#endif
     25
     26struct sock;
     27
     28#ifdef CONFIG_IPV6_MROUTE
     29extern int ip6_mroute_setsockopt(struct sock *, int, sockptr_t, unsigned int);
     30extern int ip6_mroute_getsockopt(struct sock *, int, char __user *, int __user *);
     31extern int ip6_mr_input(struct sk_buff *skb);
     32extern int ip6mr_ioctl(struct sock *sk, int cmd, void __user *arg);
     33extern int ip6mr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg);
     34extern int ip6_mr_init(void);
     35extern void ip6_mr_cleanup(void);
     36#else
     37static inline int ip6_mroute_setsockopt(struct sock *sock, int optname,
     38		sockptr_t optval, unsigned int optlen)
     39{
     40	return -ENOPROTOOPT;
     41}
     42
     43static inline
     44int ip6_mroute_getsockopt(struct sock *sock,
     45			  int optname, char __user *optval, int __user *optlen)
     46{
     47	return -ENOPROTOOPT;
     48}
     49
     50static inline
     51int ip6mr_ioctl(struct sock *sk, int cmd, void __user *arg)
     52{
     53	return -ENOIOCTLCMD;
     54}
     55
     56static inline int ip6_mr_init(void)
     57{
     58	return 0;
     59}
     60
     61static inline void ip6_mr_cleanup(void)
     62{
     63	return;
     64}
     65#endif
     66
     67#ifdef CONFIG_IPV6_MROUTE_MULTIPLE_TABLES
     68bool ip6mr_rule_default(const struct fib_rule *rule);
     69#else
     70static inline bool ip6mr_rule_default(const struct fib_rule *rule)
     71{
     72	return true;
     73}
     74#endif
     75
     76#define VIFF_STATIC 0x8000
     77
     78struct mfc6_cache_cmp_arg {
     79	struct in6_addr mf6c_mcastgrp;
     80	struct in6_addr mf6c_origin;
     81};
     82
     83struct mfc6_cache {
     84	struct mr_mfc _c;
     85	union {
     86		struct {
     87			struct in6_addr mf6c_mcastgrp;
     88			struct in6_addr mf6c_origin;
     89		};
     90		struct mfc6_cache_cmp_arg cmparg;
     91	};
     92};
     93
     94#define MFC_ASSERT_THRESH (3*HZ)		/* Maximal freq. of asserts */
     95
     96struct rtmsg;
     97extern int ip6mr_get_route(struct net *net, struct sk_buff *skb,
     98			   struct rtmsg *rtm, u32 portid);
     99
    100#ifdef CONFIG_IPV6_MROUTE
    101bool mroute6_is_socket(struct net *net, struct sk_buff *skb);
    102extern int ip6mr_sk_done(struct sock *sk);
    103#else
    104static inline bool mroute6_is_socket(struct net *net, struct sk_buff *skb)
    105{
    106	return false;
    107}
    108static inline int ip6mr_sk_done(struct sock *sk)
    109{
    110	return 0;
    111}
    112#endif
    113#endif