1#ifndef _NET_DN_ROUTE_H
2#define _NET_DN_ROUTE_H
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18extern struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri);
19extern int dn_route_output_sock(struct dst_entry __rcu **pprt, struct flowidn *, struct sock *sk, int flags);
20extern int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb);
21extern void dn_rt_cache_flush(int delay);
22
23
24#define DN_RT_F_PID 0x07
25#define DN_RT_F_PF 0x80
26#define DN_RT_F_VER 0x40
27#define DN_RT_F_IE 0x20
28#define DN_RT_F_RTS 0x10
29#define DN_RT_F_RQR 0x08
30
31
32#define DN_RT_PKT_MSK 0x06
33
34#define DN_RT_PKT_SHORT 0x02
35#define DN_RT_PKT_LONG 0x06
36
37
38#define DN_RT_PKT_CNTL 0x01
39
40#define DN_RT_CNTL_MSK 0x0f
41#define DN_RT_PKT_INIT 0x01
42#define DN_RT_PKT_VERI 0x03
43#define DN_RT_PKT_HELO 0x05
44#define DN_RT_PKT_L1RT 0x07
45#define DN_RT_PKT_L2RT 0x09
46#define DN_RT_PKT_ERTH 0x0b
47#define DN_RT_PKT_EEDH 0x0d
48
49
50#define DN_RT_INFO_TYPE 0x03
51#define DN_RT_INFO_L1RT 0x02
52#define DN_RT_INFO_L2RT 0x01
53#define DN_RT_INFO_ENDN 0x03
54#define DN_RT_INFO_VERI 0x04
55#define DN_RT_INFO_RJCT 0x08
56#define DN_RT_INFO_VFLD 0x10
57#define DN_RT_INFO_NOML 0x20
58#define DN_RT_INFO_BLKR 0x40
59
60
61
62
63
64
65
66
67struct dn_route {
68 struct dst_entry dst;
69
70 struct neighbour *n;
71
72 struct flowidn fld;
73
74 __le16 rt_saddr;
75 __le16 rt_daddr;
76 __le16 rt_gateway;
77 __le16 rt_local_src;
78 __le16 rt_src_map;
79 __le16 rt_dst_map;
80
81 unsigned int rt_flags;
82 unsigned int rt_type;
83};
84
85static inline bool dn_is_input_route(struct dn_route *rt)
86{
87 return rt->fld.flowidn_iif != 0;
88}
89
90static inline bool dn_is_output_route(struct dn_route *rt)
91{
92 return rt->fld.flowidn_iif == 0;
93}
94
95extern void dn_route_init(void);
96extern void dn_route_cleanup(void);
97
98#include <net/sock.h>
99#include <linux/if_arp.h>
100
101static inline void dn_rt_send(struct sk_buff *skb)
102{
103 dev_queue_xmit(skb);
104}
105
106static inline void dn_rt_finish_output(struct sk_buff *skb, char *dst, char *src)
107{
108 struct net_device *dev = skb->dev;
109
110 if ((dev->type != ARPHRD_ETHER) && (dev->type != ARPHRD_LOOPBACK))
111 dst = NULL;
112
113 if (dev_hard_header(skb, dev, ETH_P_DNA_RT, dst, src, skb->len) >= 0)
114 dn_rt_send(skb);
115 else
116 kfree_skb(skb);
117}
118
119#endif
120