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

mroute.h (2018B)


      1/* SPDX-License-Identifier: GPL-2.0 */
      2#ifndef __LINUX_MROUTE_H
      3#define __LINUX_MROUTE_H
      4
      5#include <linux/in.h>
      6#include <linux/pim.h>
      7#include <net/fib_rules.h>
      8#include <net/fib_notifier.h>
      9#include <uapi/linux/mroute.h>
     10#include <linux/mroute_base.h>
     11#include <linux/sockptr.h>
     12
     13#ifdef CONFIG_IP_MROUTE
     14static inline int ip_mroute_opt(int opt)
     15{
     16	return opt >= MRT_BASE && opt <= MRT_MAX;
     17}
     18
     19int ip_mroute_setsockopt(struct sock *, int, sockptr_t, unsigned int);
     20int ip_mroute_getsockopt(struct sock *, int, char __user *, int __user *);
     21int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg);
     22int ipmr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg);
     23int ip_mr_init(void);
     24bool ipmr_rule_default(const struct fib_rule *rule);
     25#else
     26static inline int ip_mroute_setsockopt(struct sock *sock, int optname,
     27				       sockptr_t optval, unsigned int optlen)
     28{
     29	return -ENOPROTOOPT;
     30}
     31
     32static inline int ip_mroute_getsockopt(struct sock *sock, int optname,
     33				       char __user *optval, int __user *optlen)
     34{
     35	return -ENOPROTOOPT;
     36}
     37
     38static inline int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg)
     39{
     40	return -ENOIOCTLCMD;
     41}
     42
     43static inline int ip_mr_init(void)
     44{
     45	return 0;
     46}
     47
     48static inline int ip_mroute_opt(int opt)
     49{
     50	return 0;
     51}
     52
     53static inline bool ipmr_rule_default(const struct fib_rule *rule)
     54{
     55	return true;
     56}
     57#endif
     58
     59#define VIFF_STATIC 0x8000
     60
     61struct mfc_cache_cmp_arg {
     62	__be32 mfc_mcastgrp;
     63	__be32 mfc_origin;
     64};
     65
     66/**
     67 * struct mfc_cache - multicast routing entries
     68 * @_c: Common multicast routing information; has to be first [for casting]
     69 * @mfc_mcastgrp: destination multicast group address
     70 * @mfc_origin: source address
     71 * @cmparg: used for rhashtable comparisons
     72 */
     73struct mfc_cache {
     74	struct mr_mfc _c;
     75	union {
     76		struct {
     77			__be32 mfc_mcastgrp;
     78			__be32 mfc_origin;
     79		};
     80		struct mfc_cache_cmp_arg cmparg;
     81	};
     82};
     83
     84struct rtmsg;
     85int ipmr_get_route(struct net *net, struct sk_buff *skb,
     86		   __be32 saddr, __be32 daddr,
     87		   struct rtmsg *rtm, u32 portid);
     88#endif