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