more ipv6 code. Now ipv6 ping succeeds

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2011-10-12 23:15:02 +02:00
parent a53cf6534d
commit 7c006811f8
9 changed files with 541 additions and 141 deletions

View file

@ -105,6 +105,8 @@ struct grub_net_slaac_mac_list
char *name;
};
struct grub_net_link_layer_entry;
struct grub_net_card
{
struct grub_net_card *next;
@ -118,6 +120,8 @@ struct grub_net_card
grub_uint64_t last_poll;
grub_size_t mtu;
struct grub_net_slaac_mac_list *slaac_list;
grub_ssize_t new_ll_entry;
struct grub_net_link_layer_entry *link_layer_table;
union
{
#ifdef GRUB_MACHINE_EFI
@ -455,6 +459,19 @@ grub_net_network_level_interface_unregister (struct grub_net_network_level_inter
void
grub_net_tcp_retransmit (void);
void
grub_net_link_layer_add_address (struct grub_net_card *card,
const grub_net_network_level_address_t *nl,
const grub_net_link_level_address_t *ll,
int override);
int
grub_net_link_layer_resolve_check (struct grub_net_network_level_interface *inf,
const grub_net_network_level_address_t *proto_addr);
grub_err_t
grub_net_link_layer_resolve (struct grub_net_network_level_interface *inf,
const grub_net_network_level_address_t *proto_addr,
grub_net_link_level_address_t *hw_addr);
extern char *grub_net_default_server;
#define GRUB_NET_TRIES 40

View file

@ -21,10 +21,11 @@
#include <grub/misc.h>
#include <grub/net.h>
extern grub_err_t grub_net_arp_receive(struct grub_net_buff *nb);
extern grub_err_t grub_net_arp_receive (struct grub_net_buff *nb,
struct grub_net_card *card);
extern grub_err_t grub_net_arp_resolve(struct grub_net_network_level_interface *inf,
const grub_net_network_level_address_t *addr,
grub_net_link_level_address_t *hw_addr);
grub_err_t
grub_net_arp_send_request (struct grub_net_network_level_interface *inf,
const grub_net_network_level_address_t *proto_addr);
#endif

View file

@ -64,7 +64,8 @@ grub_net_recv_icmp6_packet (struct grub_net_buff *nb,
struct grub_net_card *card,
struct grub_net_network_level_interface *inf,
const grub_net_network_level_address_t *source,
const grub_net_network_level_address_t *dest);
const grub_net_network_level_address_t *dest,
grub_uint8_t ttl);
grub_err_t
grub_net_recv_udp_packet (struct grub_net_buff *nb,
struct grub_net_network_level_interface *inf,
@ -83,5 +84,8 @@ grub_net_ip_transport_checksum (struct grub_net_buff *nb,
struct grub_net_network_level_interface *
grub_net_ipv6_get_link_local (struct grub_net_card *card,
const grub_net_link_level_address_t *hwaddr);
grub_err_t
grub_net_icmp6_send_request (struct grub_net_network_level_interface *inf,
const grub_net_network_level_address_t *proto_addr);
#endif

View file

@ -154,6 +154,18 @@ typedef grub_uint64_t grub_disk_addr_t;
#define grub_swap_bytes16_compile_time(x) ((((x) & 0xff) << 8) | (((x) & 0xff00) >> 8))
#define grub_swap_bytes32_compile_time(x) ((((x) & 0xff) << 24) | (((x) & 0xff00) << 8) | (((x) & 0xff0000) >> 8) | (((x) & 0xff000000UL) >> 24))
#define grub_swap_bytes64_compile_time(x) \
({ \
grub_uint64_t _x = (x); \
(grub_uint64_t) ((_x << 56) \
| ((_x & (grub_uint64_t) 0xFF00ULL) << 40) \
| ((_x & (grub_uint64_t) 0xFF0000ULL) << 24) \
| ((_x & (grub_uint64_t) 0xFF000000ULL) << 8) \
| ((_x & (grub_uint64_t) 0xFF00000000ULL) >> 8) \
| ((_x & (grub_uint64_t) 0xFF0000000000ULL) >> 24) \
| ((_x & (grub_uint64_t) 0xFF000000000000ULL) >> 40) \
| (_x >> 56)); \
})
#if defined(__GNUC__) && (__GNUC__ > 3) && (__GNUC__ > 4 || __GNUC_MINOR__ >= 3)
static inline grub_uint32_t grub_swap_bytes32(grub_uint32_t x)
@ -202,6 +214,9 @@ static inline grub_uint64_t grub_swap_bytes64(grub_uint64_t x)
# define grub_be_to_cpu16(x) ((grub_uint16_t) (x))
# define grub_be_to_cpu32(x) ((grub_uint32_t) (x))
# define grub_be_to_cpu64(x) ((grub_uint64_t) (x))
# define grub_cpu_to_be32_compile_time(x) ((grub_uint32_t) (x))
# define grub_cpu_to_be64_compile_time(x) ((grub_uint64_t) (x))
# define grub_be_to_cpu64_compile_time(x) ((grub_uint64_t) (x))
# define grub_cpu_to_le32_compile_time(x) grub_swap_bytes32_compile_time(x)
# define grub_cpu_to_le16_compile_time(x) grub_swap_bytes16_compile_time(x)
#else /* ! WORDS_BIGENDIAN */
@ -217,8 +232,12 @@ static inline grub_uint64_t grub_swap_bytes64(grub_uint64_t x)
# define grub_be_to_cpu16(x) grub_swap_bytes16(x)
# define grub_be_to_cpu32(x) grub_swap_bytes32(x)
# define grub_be_to_cpu64(x) grub_swap_bytes64(x)
# define grub_cpu_to_be32_compile_time(x) grub_swap_bytes32_compile_time(x)
# define grub_cpu_to_be64_compile_time(x) grub_swap_bytes64_compile_time(x)
# define grub_be_to_cpu64_compile_time(x) grub_swap_bytes64_compile_time(x)
# define grub_cpu_to_le16_compile_time(x) ((grub_uint16_t) (x))
# define grub_cpu_to_le32_compile_time(x) ((grub_uint32_t) (x))
#endif /* ! WORDS_BIGENDIAN */
#endif /* ! GRUB_TYPES_HEADER */