2010-10-14 13:14:16 +02:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2010-11-08 10:33:23 +01:00
|
|
|
/* router solicitation */
|
2010-11-09 22:20:26 +01:00
|
|
|
#define RTR_SOL_LEN 4
|
2010-11-08 10:33:23 +01:00
|
|
|
#define RTR_SOL_INTERVAL 4
|
2010-11-09 22:20:26 +01:00
|
|
|
#define RTR_SOL_MAX 3
|
|
|
|
/* router advertisment */
|
|
|
|
#define RTR_ADV_M_FLAG 0
|
|
|
|
#define RTR_ADV_O_FLAG 0
|
|
|
|
#define RTR_ADV_MAX 3
|
|
|
|
#define RTR_ADV_MAX_INTERVAL 600
|
|
|
|
#define RTR_ADV_LEN 12
|
|
|
|
/* icmp message types rfc4861 4.*/
|
|
|
|
#define ICMP_RTR_ADV 134
|
|
|
|
#define ICMP_RTR_SOL 133
|
|
|
|
/* stllao option rfc4861 4.6.1 */
|
|
|
|
#define OPT_STLLAO_LEN 16
|
|
|
|
#define OPT_SLLAO_TYPE 1
|
|
|
|
#define OPT_TLLAO_TYPE 2
|
|
|
|
/* mtu option rfc4861 4.6.4 */
|
|
|
|
#define OPT_MTU_TYPE 5
|
|
|
|
#define OPT_MTU_LEN 1
|
|
|
|
#define OPT_MTU_HDR_LEN 8
|
2010-10-17 16:05:14 +02:00
|
|
|
|
2010-11-09 22:20:26 +01:00
|
|
|
typedef struct opt_stllao {
|
2010-10-17 16:05:14 +02:00
|
|
|
uint8_t type;
|
|
|
|
uint8_t length;
|
2010-11-09 22:20:26 +01:00
|
|
|
} opt_stllao;
|
2010-10-17 16:05:14 +02:00
|
|
|
|
2010-11-09 22:20:26 +01:00
|
|
|
typedef struct opt_mtu {
|
2010-11-08 10:33:23 +01:00
|
|
|
uint8_t type;
|
|
|
|
uint8_t length;
|
|
|
|
uint16_t reserved;
|
|
|
|
uint32_t mtu;
|
2010-11-09 22:20:26 +01:00
|
|
|
} opt_mtu;
|
2010-11-08 10:33:23 +01:00
|
|
|
|
2010-11-09 22:20:26 +01:00
|
|
|
typedef struct opt_pi {
|
2010-11-08 10:33:23 +01:00
|
|
|
uint8_t type;
|
|
|
|
uint8_t length;
|
|
|
|
uint8_t prefix_length;
|
|
|
|
uint8_t reserved1;
|
|
|
|
uint32_t valid_lifetime;
|
|
|
|
uint32_t preferred_lifetime;
|
|
|
|
ipv6_addr prefix;
|
2010-11-09 22:20:26 +01:00
|
|
|
} opt_pi;
|
|
|
|
|
|
|
|
typedef struct prefix_list {
|
|
|
|
ipv6_addr prefix;
|
|
|
|
uint8_t inuse;
|
|
|
|
uint8_t advertisment;
|
|
|
|
} prefix_list;
|
2010-11-08 10:33:23 +01:00
|
|
|
|
2010-11-09 22:20:26 +01:00
|
|
|
struct rtr_adv {
|
2010-11-08 10:33:23 +01:00
|
|
|
uint8_t hoplimit;
|
|
|
|
uint8_t autoconfig_flags;
|
|
|
|
uint16_t router_lifetime;
|
|
|
|
uint32_t reachable_time;
|
|
|
|
uint32_t retrans_timer;
|
|
|
|
};
|
2010-10-17 16:05:14 +02:00
|
|
|
|
2010-11-09 22:20:26 +01:00
|
|
|
void send_rtr_sol(void);
|
2010-10-17 16:05:14 +02:00
|
|
|
uint16_t chksum_calc(uint8_t type);
|