linux/include/net/neighbour.h

/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _NET_NEIGHBOUR_H
#define _NET_NEIGHBOUR_H

#include <linux/neighbour.h>

/*
 *	Generic neighbour manipulation
 *
 *	Authors:
 *	Pedro Roque		<[email protected]>
 *	Alexey Kuznetsov	<[email protected]>
 *
 * 	Changes:
 *
 *	Harald Welte:		<[email protected]>
 *		- Add neighbour cache statistics like rtstat
 */

#include <linux/atomic.h>
#include <linux/refcount.h>
#include <linux/netdevice.h>
#include <linux/skbuff.h>
#include <linux/rcupdate.h>
#include <linux/seq_file.h>
#include <linux/bitmap.h>

#include <linux/err.h>
#include <linux/sysctl.h>
#include <linux/workqueue.h>
#include <net/rtnetlink.h>

/*
 * NUD stands for "neighbor unreachability detection"
 */

#define NUD_IN_TIMER
#define NUD_VALID
#define NUD_CONNECTED

struct neighbour;

enum {};

struct neigh_parms {};

static inline void neigh_var_set(struct neigh_parms *p, int index, int val)
{}

#define NEIGH_VAR(p, attr)

/* In ndo_neigh_setup, NEIGH_VAR_INIT should be used.
 * In other cases, NEIGH_VAR_SET should be used.
 */
#define NEIGH_VAR_INIT(p, attr, val)
#define NEIGH_VAR_SET(p, attr, val)

static inline void neigh_parms_data_state_setall(struct neigh_parms *p)
{}

static inline void neigh_parms_data_state_cleanall(struct neigh_parms *p)
{}

struct neigh_statistics {};

#define NEIGH_CACHE_STAT_INC(tbl, field)

struct neighbour {} __randomize_layout;

struct neigh_ops {};

struct pneigh_entry {};

/*
 *	neighbour table manipulation
 */

#define NEIGH_NUM_HASH_RND

struct neigh_hash_table {};


struct neigh_table {};

enum {};

static inline int neigh_parms_family(struct neigh_parms *p)
{}

#define NEIGH_PRIV_ALIGN
#define NEIGH_ENTRY_SIZE(size)

static inline void *neighbour_priv(const struct neighbour *n)
{}

/* flags for neigh_update() */
#define NEIGH_UPDATE_F_OVERRIDE
#define NEIGH_UPDATE_F_WEAK_OVERRIDE
#define NEIGH_UPDATE_F_OVERRIDE_ISROUTER
#define NEIGH_UPDATE_F_USE
#define NEIGH_UPDATE_F_MANAGED
#define NEIGH_UPDATE_F_EXT_LEARNED
#define NEIGH_UPDATE_F_ISROUTER
#define NEIGH_UPDATE_F_ADMIN

/* In-kernel representation for NDA_FLAGS_EXT flags: */
#define NTF_OLD_MASK
#define NTF_EXT_SHIFT
#define NTF_EXT_MASK

#define NTF_MANAGED

extern const struct nla_policy nda_policy[];

static inline bool neigh_key_eq32(const struct neighbour *n, const void *pkey)
{}

static inline bool neigh_key_eq128(const struct neighbour *n, const void *pkey)
{}

static inline struct neighbour *___neigh_lookup_noref(
	struct neigh_table *tbl,
	bool (*key_eq)(const struct neighbour *n, const void *pkey),
	__u32 (*hash)(const void *pkey,
		      const struct net_device *dev,
		      __u32 *hash_rnd),
	const void *pkey,
	struct net_device *dev)
{}

static inline struct neighbour *__neigh_lookup_noref(struct neigh_table *tbl,
						     const void *pkey,
						     struct net_device *dev)
{}

static inline void neigh_confirm(struct neighbour *n)
{}

void neigh_table_init(int index, struct neigh_table *tbl);
int neigh_table_clear(int index, struct neigh_table *tbl);
struct neighbour *neigh_lookup(struct neigh_table *tbl, const void *pkey,
			       struct net_device *dev);
struct neighbour *__neigh_create(struct neigh_table *tbl, const void *pkey,
				 struct net_device *dev, bool want_ref);
static inline struct neighbour *neigh_create(struct neigh_table *tbl,
					     const void *pkey,
					     struct net_device *dev)
{}
void neigh_destroy(struct neighbour *neigh);
int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb,
		       const bool immediate_ok);
int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new, u32 flags,
		 u32 nlmsg_pid);
void __neigh_set_probe_once(struct neighbour *neigh);
bool neigh_remove_one(struct neighbour *ndel, struct neigh_table *tbl);
void neigh_changeaddr(struct neigh_table *tbl, struct net_device *dev);
int neigh_ifdown(struct neigh_table *tbl, struct net_device *dev);
int neigh_carrier_down(struct neigh_table *tbl, struct net_device *dev);
int neigh_resolve_output(struct neighbour *neigh, struct sk_buff *skb);
int neigh_connected_output(struct neighbour *neigh, struct sk_buff *skb);
int neigh_direct_output(struct neighbour *neigh, struct sk_buff *skb);
struct neighbour *neigh_event_ns(struct neigh_table *tbl,
						u8 *lladdr, void *saddr,
						struct net_device *dev);

struct neigh_parms *neigh_parms_alloc(struct net_device *dev,
				      struct neigh_table *tbl);
void neigh_parms_release(struct neigh_table *tbl, struct neigh_parms *parms);

static inline
struct net *neigh_parms_net(const struct neigh_parms *parms)
{}

unsigned long neigh_rand_reach_time(unsigned long base);

void pneigh_enqueue(struct neigh_table *tbl, struct neigh_parms *p,
		    struct sk_buff *skb);
struct pneigh_entry *pneigh_lookup(struct neigh_table *tbl, struct net *net,
				   const void *key, struct net_device *dev,
				   int creat);
struct pneigh_entry *__pneigh_lookup(struct neigh_table *tbl, struct net *net,
				     const void *key, struct net_device *dev);
int pneigh_delete(struct neigh_table *tbl, struct net *net, const void *key,
		  struct net_device *dev);

static inline struct net *pneigh_net(const struct pneigh_entry *pneigh)
{}

void neigh_app_ns(struct neighbour *n);
void neigh_for_each(struct neigh_table *tbl,
		    void (*cb)(struct neighbour *, void *), void *cookie);
void __neigh_for_each_release(struct neigh_table *tbl,
			      int (*cb)(struct neighbour *));
int neigh_xmit(int fam, struct net_device *, const void *, struct sk_buff *);

struct neigh_seq_state {};
void *neigh_seq_start(struct seq_file *, loff_t *, struct neigh_table *,
		      unsigned int);
void *neigh_seq_next(struct seq_file *, void *, loff_t *);
void neigh_seq_stop(struct seq_file *, void *);

int neigh_proc_dointvec(const struct ctl_table *ctl, int write,
			void *buffer, size_t *lenp, loff_t *ppos);
int neigh_proc_dointvec_jiffies(const struct ctl_table *ctl, int write,
				void *buffer,
				size_t *lenp, loff_t *ppos);
int neigh_proc_dointvec_ms_jiffies(const struct ctl_table *ctl, int write,
				   void *buffer, size_t *lenp, loff_t *ppos);

int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p,
			  proc_handler *proc_handler);
void neigh_sysctl_unregister(struct neigh_parms *p);

static inline void __neigh_parms_put(struct neigh_parms *parms)
{}

static inline struct neigh_parms *neigh_parms_clone(struct neigh_parms *parms)
{}

/*
 *	Neighbour references
 */

static inline void neigh_release(struct neighbour *neigh)
{}

static inline struct neighbour * neigh_clone(struct neighbour *neigh)
{}

#define neigh_hold(n)

static __always_inline int neigh_event_send_probe(struct neighbour *neigh,
						  struct sk_buff *skb,
						  const bool immediate_ok)
{}

static inline int neigh_event_send(struct neighbour *neigh, struct sk_buff *skb)
{}

#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
static inline int neigh_hh_bridge(struct hh_cache *hh, struct sk_buff *skb)
{}
#endif

static inline int neigh_hh_output(const struct hh_cache *hh, struct sk_buff *skb)
{}

static inline int neigh_output(struct neighbour *n, struct sk_buff *skb,
			       bool skip_cache)
{}

static inline struct neighbour *
__neigh_lookup(struct neigh_table *tbl, const void *pkey, struct net_device *dev, int creat)
{}

static inline struct neighbour *
__neigh_lookup_errno(struct neigh_table *tbl, const void *pkey,
  struct net_device *dev)
{}

struct neighbour_cb {};

#define LOCALLY_ENQUEUED

#define NEIGH_CB(skb)

static inline void neigh_ha_snapshot(char *dst, const struct neighbour *n,
				     const struct net_device *dev)
{}

static inline void neigh_update_is_router(struct neighbour *neigh, u32 flags,
					  int *notify)
{}
#endif