grub-core/net/arp.c: trim arp packets with abnormal size.
PATCH 1/1 grub-core/net/arp.c: trim arp packets with abnormal size.
* grub-core/net/arp.c (grub_net_arp_receive): Trim arp packets with abnormal size.
GRUB uses arp request to create the arp response. If the incoming packet is foobared, GRUB needs to trim the arp response packet before sending it.
This is just a fix in time for 2.02. I'm planning to rewrite the arp response code after the release.
ChangeLog +8 -0
@@ -1,3 +1,11 @@ +2014-01-31 Paulo Flabiano Smorigo <[email protected]> + + * grub-core/net/arp.c (grub_net_arp_receive): Trim arp packets with + abnormal size. + + GRUB uses arp request to create the arp response. If the incoming packet is + foobared, GRUB needs to trim the arp response packet before sending it. + 2014-01-29 Vladimir Serbinenko <[email protected]> * grub-core/disk/ahci.c: Increase timeout. Some SSDs take up to
grub-core/net/arp.c +6 -0
@@ -162,6 +162,12 @@ grub_net_arp_receive (struct grub_net_buff *nb,if (grub_net_addr_cmp (&inf->address, &target_addr) ==0 &&grub_be_to_cpu16 (arp_header->op) ==ARP_REQUEST ) { +if ((nb->tail - nb->data) >50 ) + { +grub_dprintf ("net" ,"arp packet with abnormal size (%ld bytes).\n" , + nb->tail - nb->data); + nb->tail = nb->data +50 ; + }grub_net_link_level_address_t target;/* We've already checked that pln is either 4 or 16. */ char tmp[16 ];
Signature · 2 lines
Paulo Flabiano Smorigo IBM Linux Technology Center
В Fri, 31 Jan 2014 13:35:11 -0200
Paulo Flabiano Smorigo <[email protected]> пишет:
Quoted 29 lines
*
grub-core/net/arp.c(grub_net_arp_receive): Trim arp packets with abnormal size.GRUB uses arp request to create the arp response. If the incoming packet is foobared, GRUB needs to trim the arp response packet before sending it.
This is just a fix in time for 2.02. I'm planning to rewrite the arp response code after the release.
ChangeLog +8
-0@@ -1,3 +1,11 @@ +2014-01-31 Paulo Flabiano Smorigo <[email protected]> + + * grub-core/net/arp.c (grub_net_arp_receive): Trim arp packets with + abnormal size. + + GRUB uses arp request to create the arp response. If the incoming packet is + foobared, GRUB needs to trim the arp response packet before sending it. + 2014-01-29 Vladimir Serbinenko <[email protected]> * grub-core/disk/ahci.c: Increase timeout. Some SSDs take up togrub-core/net/arp.c +0
-0
grub-core/net/arp.c grub_net_arp_receive (struct grub_net_buff *nb, · line 165
Quoted 4 lines
grub-core/net/arp.c +1
-0@@ -162,6 +162,12 @@ grub_net_arp_receive (struct grub_net_buff *nb,if (grub_net_addr_cmp (&inf->address, &target_addr) ==0 &&grub_be_to_cpu16 (arp_header->op) ==ARP_REQUEST ) { +if ((nb->tail - nb->data) >50 )
Using large ping size is quite common during network troubleshooting. This looks like rather arbitrary restriction. I'd say - if we were able to receive packet we should be able to also send packet of the same size; what problem does it fix?
Quoted 9 lines
grub-core/net/arp.c +5
-0+ { +grub_dprintf ("net" ,"arp packet with abnormal size (%ld bytes).\n" , + nb->tail - nb->data); + nb->tail = nb->data +50 ; + }grub_net_link_level_address_t target;/* We've already checked that pln is either 4 or 16. */ char tmp[16 ];
Quoted 26 lines · Andrey Borzenkov
В Fri, 31 Jan 2014 13:35:11 -0200
Paulo Flabiano Smorigo <[email protected]> пишет:Quoted 23 lines
*
grub-core/net/arp.c(grub_net_arp_receive): Trim arp packets with abnormal size.GRUB uses arp request to create the arp response. If the incoming packet is foobared, GRUB needs to trim the arp response packet before sending it.
This is just a fix in time for 2.02. I'm planning to rewrite the arp response code after the release.
ChangeLog +8
-0@@ -1,3 +1,11 @@ +2014-01-31 Paulo Flabiano Smorigo <[email protected]> + + * grub-core/net/arp.c (grub_net_arp_receive): Trim arp packets with + abnormal size. + + GRUB uses arp request to create the arp response. If the incoming packet is + foobared, GRUB needs to trim the arp response packet before sending it. + 2014-01-29 Vladimir Serbinenko <[email protected]>
Quoted 15 lines
grub-core/net/arp.c grub_net_arp_receive (struct grub_net_buff *nb, · line 165
Quoted 10 lines
ChangeLog +0
-0* grub-core/disk/ahci.c: Increase timeout. Some SSDs take up togrub-core/net/arp.c +1
-0@@ -162,6 +162,12 @@ grub_net_arp_receive (struct grub_net_buff *nb,if (grub_net_addr_cmp (&inf->address, &target_addr) ==0 &&grub_be_to_cpu16 (arp_header->op) ==ARP_REQUEST ) { +if ((nb->tail - nb->data) >50 )Using large ping size is quite common during network troubleshooting. This looks like rather arbitrary restriction. I'd say - if we were able to receive packet we should be able to also send packet of the same size; what problem does it fix?
I hit a firmware bug where after a while every packet comes with MTU size (~1500 bytes). GRUB handles those foobared packets well and the only problem is the case that I described above:
ARP responses are built using ARP request as its base. ARP responses with trash are usually ignored by the network and my patch only trim the arp responses to the corrent size, nothing more.
Quoted 16 lines
grub-core/net/arp.c grub_net_arp_receive (struct grub_net_buff *nb, · line 173
Quoted 10 lines
grub-core/net/arp.c +5
-0+ { +grub_dprintf ("net" ,"arp packet with abnormal size (%ld bytes).\n" , + nb->tail - nb->data); + nb->tail = nb->data +50 ; + }grub_net_link_level_address_t target;/* We've already checked that pln is either 4 or 16. */ char tmp[16 ];_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 2 lines
Paulo Flabiano Smorigo IBM Linux Technology Center
Quoted 2 lines · Andrey Borzenkov
Using large ping size is quite common during network troubleshooting. This looks like rather arbitrary restriction.
ARP != ICMP
Quoted 29 lines · Paulo Flabiano Smorigo
*
grub-core/net/arp.c(grub_net_arp_receive): Trim arp packets with abnormal size.GRUB uses arp request to create the arp response. If the incoming packet is foobared, GRUB needs to trim the arp response packet before sending it.
This is just a fix in time for 2.02. I'm planning to rewrite the arp response code after the release.
ChangeLog +8
-0@@ -1,3 +1,11 @@ +2014-01-31 Paulo Flabiano Smorigo <[email protected]> + + * grub-core/net/arp.c (grub_net_arp_receive): Trim arp packets with + abnormal size. + + GRUB uses arp request to create the arp response. If the incoming packet is + foobared, GRUB needs to trim the arp response packet before sending it. + 2014-01-29 Vladimir Serbinenko <[email protected]> * grub-core/disk/ahci.c: Increase timeout. Some SSDs take up togrub-core/net/arp.c +0
-0
grub-core/net/arp.c grub_net_arp_receive (struct grub_net_buff *nb, · line 170
Quoted 9 lines
grub-core/net/arp.c +6
-0@@ -162,6 +162,12 @@ grub_net_arp_receive (struct grub_net_buff *nb,if (grub_net_addr_cmp (&inf->address, &target_addr) ==0 &&grub_be_to_cpu16 (arp_header->op) ==ARP_REQUEST ) { +if ((nb->tail - nb->data) >50 ) + { +grub_dprintf ("net" ,"arp packet with abnormal size (%ld bytes).\n" , + nb->tail - nb->data); + nb->tail = nb->data +50 ; + }
This is not right solution, I already commented on it. Instead you need to recompute arp length from its fields.
Quoted 4 lines
grub-core/net/arp.c +0
-0grub_net_link_level_address_t target;/* We've already checked that pln is either 4 or 16. */ char tmp[16 ];