1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Copyright (C) 2013 Allied Telesis Labs NZ
4 * Chris Packham, <judge.packham@gmail.com>
6 * Copyright (C) 2022 YADRO
7 * Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>
15 /* struct nd_msg - ICMPv6 Neighbour Discovery message format */
17 struct icmp6hdr icmph;
18 struct in6_addr target;
22 /* struct echo_msg - ICMPv6 echo request/reply message format */
24 struct icmp6hdr icmph;
29 /* Neigbour Discovery option types */
31 __ND_OPT_PREFIX_INFO_END = 0,
32 ND_OPT_SOURCE_LL_ADDR = 1,
33 ND_OPT_TARGET_LL_ADDR = 2,
34 ND_OPT_PREFIX_INFO = 3,
35 ND_OPT_REDIRECT_HDR = 4,
40 /* IPv6 destination address of packet waiting for ND */
41 extern struct in6_addr net_nd_sol_packet_ip6;
42 /* MAC destination address of packet waiting for ND */
43 extern uchar *net_nd_packet_mac;
44 /* pointer to packet waiting to be transmitted after ND is resolved */
45 extern uchar *net_nd_tx_packet;
46 /* size of packet waiting to be transmitted */
47 extern int net_nd_tx_packet_size;
48 /* the timer for ND resolution */
49 extern ulong net_nd_timer_start;
50 /* the number of requests we have sent so far */
51 extern int net_nd_try;
55 * ndisc_init() - Make initial steps for ND state machine.
56 * Usually move variables into initial state.
58 void ndisc_init(void);
61 * ndisc_receive() - Handle ND packet
63 * @et: pointer to incoming packet
64 * @ip6: pointer to IPv6 header
65 * @len: incoming packet length
66 * Return: 0 if handle successfully, -1 if unsupported/unknown ND packet type
68 int ndisc_receive(struct ethernet_hdr *et, struct ip6_hdr *ip6, int len);
71 * ndisc_request() - Send ND request
73 void ndisc_request(void);
76 * ndisc_init() - Check ND response timeout
78 * Return: 0 if no timeout, -1 otherwise
80 int ndisc_timeout_check(void);
82 static inline void ndisc_init(void)
87 ndisc_receive(struct ethernet_hdr *et, struct ip6_hdr *ip6, int len)
92 static inline void ndisc_request(void)
96 static inline int ndisc_timeout_check(void)
102 #endif /* __NDISC_H__ */