Run indent on files.
This commit is contained in:
parent
423a1849ef
commit
4700d08bb4
8 changed files with 307 additions and 288 deletions
|
@ -8,25 +8,25 @@
|
|||
#include <grub/time.h>
|
||||
#include <grub/net/arp.h>
|
||||
|
||||
grub_err_t
|
||||
grub_err_t
|
||||
send_ethernet_packet (struct grub_net_network_level_interface *inf,
|
||||
struct grub_net_buff *nb,
|
||||
grub_net_link_level_address_t target_addr,
|
||||
grub_uint16_t ethertype)
|
||||
{
|
||||
struct etherhdr *eth;
|
||||
struct etherhdr *eth;
|
||||
|
||||
grub_netbuff_push (nb,sizeof(*eth));
|
||||
eth = (struct etherhdr *) nb->data;
|
||||
grub_memcpy(eth->dst, target_addr.mac, 6);
|
||||
grub_memcpy(eth->src, inf->hwaddress.mac, 6);
|
||||
grub_netbuff_push (nb, sizeof (*eth));
|
||||
eth = (struct etherhdr *) nb->data;
|
||||
grub_memcpy (eth->dst, target_addr.mac, 6);
|
||||
grub_memcpy (eth->src, inf->hwaddress.mac, 6);
|
||||
|
||||
eth->type = grub_cpu_to_be16 (ethertype);
|
||||
|
||||
return inf->card->driver->send (inf->card, nb);
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
grub_err_t
|
||||
grub_net_recv_ethernet_packet (struct grub_net_buff *nb)
|
||||
{
|
||||
struct etherhdr *eth;
|
||||
|
@ -34,32 +34,32 @@ grub_net_recv_ethernet_packet (struct grub_net_buff *nb)
|
|||
struct snaphdr *snaph;
|
||||
grub_uint16_t type;
|
||||
|
||||
eth = (struct etherhdr *) nb->data;
|
||||
eth = (struct etherhdr *) nb->data;
|
||||
type = grub_be_to_cpu16 (eth->type);
|
||||
grub_netbuff_pull (nb, sizeof (*eth));
|
||||
|
||||
|
||||
if (type <= 1500)
|
||||
{
|
||||
llch = (struct llchdr *) nb->data;
|
||||
type = llch->dsap & LLCADDRMASK;
|
||||
|
||||
if (llch->dsap == 0xaa && llch->ssap == 0xaa && llch->ctrl == 0x3)
|
||||
{
|
||||
grub_netbuff_pull (nb,sizeof(*llch));
|
||||
{
|
||||
grub_netbuff_pull (nb, sizeof (*llch));
|
||||
snaph = (struct snaphdr *) nb->data;
|
||||
type = snaph->type;
|
||||
}
|
||||
}
|
||||
|
||||
/* ARP packet */
|
||||
/* ARP packet. */
|
||||
if (type == GRUB_NET_ETHERTYPE_ARP)
|
||||
{
|
||||
grub_net_arp_receive (nb);
|
||||
grub_netbuff_free (nb);
|
||||
}
|
||||
/* IP packet */
|
||||
/* IP packet. */
|
||||
if (type == GRUB_NET_ETHERTYPE_IP)
|
||||
grub_net_recv_ip_packets (nb);
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue