Paulo Flabiano Smorigo
d9f7de0ae3
Add Virtual LAN support.
...
This patch adds support for virtual LAN (VLAN) tagging. VLAN tagging allows
multiple VLANs in a bridged network to share the same physical network link
but maintain isolation:
http://en.wikipedia.org/wiki/IEEE_802.1Q
* grub-core/net/ethernet.c: Add check, get, and set vlan tag id.
* grub-core/net/drivers/ieee1275/ofnet.c: Get vlan tag id from bootargs.
* grub-core/net/arp.c: Add check.
* grub-core/net/ip.c: Likewise.
* include/grub/net/arp.h: Add vlantag attribute.
* include/grub/net/ip.h: Likewise.
2017-05-03 13:03:50 +02:00
Sakar Arora
e563928ba4
net/ip: Fix limit_time calculation in freeing old fragments
...
limit_time underflows when current time is less than 90000ms.
This causes packet fragments received during this time, i.e.,
till 90000ms pass since timer init, to be rejected.
Hence, set it to 0 if its less than 90000.
Signed-off-by: Sakar Arora <Sakar.Arora@nxp.com>
2016-10-18 20:26:42 +03:00
Andrei Borzenkov
b40fde29a4
net/ip: check result of grub_netbuff_push
...
Found by: Coverity scan.
2015-01-30 22:09:51 +03:00
Andrey Borzenkov
954fe77163
cleanup: grub_cpu_to_XXX_compile_time for constants
...
This tries to catch all cases where grub_cpu_to_XXX was used for constant
expressions (including sizeof).
2014-09-22 20:47:10 +04:00
Vladimir Serbinenko
7e47e27bd8
Add gcc_struct to all packed structures when compiling with mingw.
...
Just "packed" doesn't always pack the way we expect.
2013-12-15 14:14:30 +01:00
Vladimir 'phcoder' Serbinenko
54ea2f4401
* grub-core/disk/ahci.c: Add needed explicit cast.
...
* grub-core/lib/backtrace.c: Likewise.
* grub-core/net/ip.c: Likewise.
* grub-core/net/tcp.c: Likewise.
* grub-core/net/udp.c: Likewise.
2013-08-21 21:02:14 +02:00
Bean
5efb817d64
* grub-core/net/ip.c (reassemble): Make asm_buffer into asm_netbuff.
...
All users updated.
(free_rsm): Free header as well.
(free_old_fragments): Fix memory leak.
* grub-core/net/netbuff.c (grub_netbuff_free): Make return void.
* grub-core/net/tftp.c (tftp_receive): Fix memory leak.
(destroy_pq): Likewise.
* include/grub/net/netbuff.h (grub_netbuff_free): Make return void.
2012-05-08 16:03:02 +02:00
Vladimir 'phcoder' Serbinenko
a626fdd76a
* grub-core/net/ip.c (handle_dgram): Fix undeclared variable.
2012-05-01 15:29:44 +02:00
Bean
ba15b2afa0
* grub-core/net/ip.c (handle_dgram): Fix DHCP mac comparison.
...
Also-By: Vladimir Serbinenko <phcoder@gmail.com>
2012-05-01 15:20:20 +02:00
Vladimir 'phcoder' Serbinenko
def9fc1bb2
* grub-core/disk/diskfilter.c (read_segment): Renome unreachable code.
...
* grub-core/net/ip.c (grub_net_recv_ip4_packets): Likewise.
2012-02-09 23:43:43 +01:00
Vladimir 'phcoder' Serbinenko
9c4b5c13e6
Improve gettext support. Stylistic fixes and error handling fixes while
...
on it.
2012-02-08 19:26:01 +01:00
Vladimir 'phcoder' Serbinenko
198e150aaf
IPv6, TCP, HTTP, ICMP and DNS support. Several cleanups and bugfixes.
...
* grub-core/Makefile.core.def (net): Add net/dns.c, net/tcp.c,
net/icmp.c and net/icmp6.c.
(http): New module.
(priority_queue): Likewise.
* grub-core/io/bufio.c: Rewritten.
* grub-core/lib/legacy_parse.c (legacy_command): New argument type
TYPE_WITH_CONFIGFILE_OPTION.
(legacy_commands): Add bootp and dhcp.
(is_option): Handle TYPE_WITH_CONFIGFILE_OPTION.
(grub_legacy_parse): Likewise.
* grub-core/lib/priority_queue.c: New file.
* grub-core/net/arp.c: Add missing license header.
(arp_find_entry): Removed.
(arp_find_entry): Likewise.
(grub_net_arp_resolve): Rename to ...
(grub_net_arp_send_request): ...this.
(grub_net_arp_receive): New card argument.
* grub-core/net/bootp.c (parse_dhcp_vendor): Clean up.
Set router and DNS server.
(grub_net_configure_by_dhcp_ack): Handle routing information.
(grub_cmd_bootp): Set checksum.
(grub_bootp_init): Remove net_dhcp.
* grub-core/net/dns.c: New file.
* grub-core/net/drivers/efi/efinet.c (send_card_buffer): Wait for
completion.
(get_card_packet): Handle allocation.
(grub_efinet_findcards): Set mtu.
* grub-core/net/drivers/emu/emunet.c: Add missing license header.
(get_card_packet): Handle allocation.
(emucard): Set mtu.
* grub-core/net/drivers/i386/pc/pxe.c (grub_pxe_recv): Handle allocation
(GRUB_MOD_INIT): Set mtu.
* grub-core/net/drivers/ieee1275/ofnet.c (grub_ofnetcard_data): Remove
mtu.
(get_card_packet): Handle allocation.
(grub_ofnet_findcards): Set mtu.
* grub-core/net/ethernet.c (send_ethernet_packet): Add compile time
assert.
(grub_net_recv_ethernet_packet): Handle IPv6.
* grub-core/net/http.c: New file.
* grub-core/net/icmp.c: Likewise.
* grub-core/net/icmp6.c: Likewise.
* grub-core/net/ip.c (ip6addr): New type.
(ip6hdr): Likewise.
(reassemble): Likewise.
(cmp): New function.
(reassembles): New variable.
(grub_net_ip_chksum): Handle 0xffff sum and unaligned buffers.
(id): New variable.
(send_fragmented): New function.
(grub_net_send_ip_packet): Rename to ...
(grub_net_send_ip4_packet): ... this. Send fragmented if needed.
Handle non-UDP.
(grub_net_recv_ip_packets): Rename to ...
(handle_dgram): ... this. Check checksum. Handle non-UDP.
(free_rsm): New function.
(free_old_fragments): Likewise.
(grub_net_recv_ip4_packets): New function.
(grub_net_send_ip6_packet): Likewise.
(grub_net_send_ip_packet): Likewise.
(grub_net_recv_ip6_packets): Likewise.
(grub_net_recv_ip_packets): Likewise.
* grub-core/net/net.c (grub_net_link_layer_entry): New struct.
(LINK_LAYER_CACHE_SIZE): New const.
(link_layer_find_entry): New function.
(grub_net_link_layer_add_address): Likewise.
(grub_net_link_layer_resolve_check): Likewise.
(grub_net_link_layer_resolve): Likewise.
(grub_net_ipv6_get_slaac): Likewise.
(grub_net_ipv6_get_link_local): Likewise.
(grub_cmd_ipv6_autoconf): Likewise.
(parse_ip): Handle one number representation.
(parse_ip6): New functoion.
(match_net): Handle IPv6.
(grub_net_resolve_address): Handle IPv6 and DNS.
(grub_net_resolve_net_address): Handle IPv6.
(route_cmp): New function.
(grub_net_route_address): Find best route.
(grub_net_addr_to_str): Handle IPv6.
(grub_net_addr_cmp): New function.
(grub_net_add_addr): Register local route.
(print_net_address): Handle net address.
(grub_net_poll_cards): Retransmit TCP.
(grub_net_poll_cards_idle_real): Likewise.
(have_ahead): New function.
(grub_net_seek_real): Use underlying seek.
(GRUB_MOD_INIT): Register net_ipv6_autoconf and init dns.
* grub-core/net/tcp.c: New file.
* grub-core/net/tftp.c (tftp_data): Add priority_queue.
(cmp): New function.
(ack): Likewise.
(tftp_receive): Handle unordered input.
(destroy_pq): New function.
(tftp_close): Close pq.
* grub-core/net/udp.c: Put missing license header.
(grub_net_udp_socket): New function.
(udp_socket_register): Likewise.
(grub_net_udp_close): Likewise.
(grub_net_recv_udp_packet): Check checksum.
* include/grub/efi/api.h (grub_efi_simple_network): Add status.
* include/grub/misc.h (grub_memchr): New function.
* include/grub/net.h (GRUB_NET_*_SIZE): New enum.
(grub_net_card_driver): Return buf in recv.
(grub_net_slaac_mac_list): New struct.
(grub_network_level_protocol_id): Add ipv6.
(grub_net_network_level_addr): Likewise.
(grub_net_network_level_net_addr): Likewise.
(grub_net_app_protocol): Add seek.
(grub_net_socket): Removed.
(grub_net_sockets): Likewise.
(grub_net_socket_register): Likewise.
(grub_net_socket_unregister): Likewise.
(FOR_NET_SOCKETS): Likewise.
(grub_net_add_addr): Add const.
(GRUB_NET_BOOTP_*): New enum.
(grub_net_addr_cmp): New proto.
(GRUB_NET_MAX_STR_ADDR_LEN): Take IPV6 into account.
(GRUB_NET_MAX_STR_HWADDR_LEN): New define.
(grub_net_hwaddr_to_str): NEw proto.
(FOR_NET_NETWORK_LEVEL_INTERFACES): New macro.
(FOR_NET_NETWORK_LEVEL_INTERFACES_SAFE): Handle NULL.
(grub_dns_init): New proto.
(grub_dns_fini): Likewise.
(grub_net_tcp_retransmit): Likewise.
(grub_net_link_layer_add_address): Likewise.
(grub_net_link_layer_resolve_check): Likewise.
(grub_net_link_layer_resolve): Likewise.
(grub_net_dns_lookup): Likewise.
(grub_net_add_dns_server): Likewise.
(grub_net_remove_dns_server): Likewise.
(GRUB_NET_TRIES): New const.
(GRUB_NET_INTERVAL): Likewise.
* include/grub/net/arp.h: Mostly rewritten.
* include/grub/net/ethernet.h (grub_net_ethertype_t): New enum.
* include/grub/net/ip.h: Mostly rewritten.
* include/grub/net/netbuff.h: Indent.
* include/grub/net/tcp.h: New file.
* include/grub/net/udp.h: Mostly rewritten.
* include/grub/priority_queue.h: New file.
* include/grub/types.h (PRIdGRUB_SSIZE): New define.
(grub_swap_bytes64_compile_time): Likewise.
(grub_cpu_to_be16_compile_time): Likewise.
(grub_cpu_to_be32_compile_time): Likewise.
(grub_cpu_to_be64_compile_time): Likewise.
(grub_be_to_cpu64_compile_time): Likewise.
2011-12-20 18:17:07 +01:00
Vladimir 'phcoder' Serbinenko
0cb9503b70
support routed pings
2011-10-13 20:53:22 +02:00
Vladimir 'phcoder' Serbinenko
da1b289afc
IPv6. Apparently working. At least I could retrieve a file with http6
2011-10-13 01:22:56 +02:00
Vladimir 'phcoder' Serbinenko
7c006811f8
more ipv6 code. Now ipv6 ping succeeds
2011-10-12 23:15:02 +02:00
Vladimir 'phcoder' Serbinenko
a53cf6534d
some more ipv6 code
2011-10-12 10:20:55 +02:00
Vladimir 'phcoder' Serbinenko
9aad3cd91d
IPv6 support. Several fixes and unifications
2011-10-05 22:15:30 +02:00
Vladimir 'phcoder' Serbinenko
3a7af37260
basic tcp implementation
2011-07-10 08:46:48 +02:00
Vladimir 'phcoder' Serbinenko
fecdbd6b17
support ip fragmentation
2011-07-09 00:27:27 +02:00
Vladimir 'phcoder' Serbinenko
e2955971a3
move packet allocation to recv code to allow bigger buffers
2011-07-08 20:38:12 +02:00
Vladimir 'phcoder' Serbinenko
5438143da6
improve robustness of IPv4 receiving code
2011-07-08 15:43:34 +02:00
Vladimir 'phcoder' Serbinenko
1367c143dd
several cleanups. Ping reply support
2011-07-08 14:41:52 +02:00
Vladimir 'phcoder' Serbinenko
b975df6348
Send TFTP_ERROR on tftp premature close. Several cleanups
2011-07-06 12:53:37 +02:00
Vladimir 'phcoder' Serbinenko
c4d038f632
Don't react to adressed bootp packets unless in bootp transaction
2011-07-02 20:11:29 +02:00
Vladimir 'phcoder' Serbinenko
a057797f18
merge mine and abranches' branches. Fix several issues
2011-06-24 21:51:57 +02:00
Vladimir 'phcoder' Serbinenko
8b51fd98b9
bootp support
2011-06-24 20:35:25 +02:00
Manoel R. Abranches
d855fbcf37
Add error verification in netbuff operations.
2011-06-18 20:20:53 -03:00
Manoel Rebelo Abranches
4700d08bb4
Run indent on files.
2011-06-07 21:59:53 -03:00
Manoel Rebelo Abranches
25f1579b43
Adapt protocols to new network struct.
2011-04-01 05:42:34 -03:00
Vladimir 'phcoder' Serbinenko
04d22dddd9
Fix a bunch of net issues
2010-09-23 00:45:39 +02:00
Vladimir 'phcoder' Serbinenko
ce3a2ec025
Remove some dead code
2010-09-22 20:34:20 +02:00
Manoel R. Abranches
7bb47706c9
Merge grub_net into net. Compiles but is broken right now.
2010-09-16 21:57:31 +02:00