mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-05 09:53:22 +00:00
[ospfd] discount IP header size from a new LSA pkt
This commit is contained in:
parent
014b670e02
commit
c9035ccd13
@ -2869,7 +2869,7 @@ ospf_make_ls_upd (struct ospf_interface *oi, struct list *update, struct stream
|
|||||||
{
|
{
|
||||||
struct ospf_lsa *lsa;
|
struct ospf_lsa *lsa;
|
||||||
struct listnode *node;
|
struct listnode *node;
|
||||||
u_int16_t length = OSPF_LS_UPD_MIN_SIZE;
|
u_int16_t length = 0;
|
||||||
unsigned int size_noauth;
|
unsigned int size_noauth;
|
||||||
unsigned long delta = stream_get_endp (s);
|
unsigned long delta = stream_get_endp (s);
|
||||||
unsigned long pp;
|
unsigned long pp;
|
||||||
@ -2880,6 +2880,7 @@ ospf_make_ls_upd (struct ospf_interface *oi, struct list *update, struct stream
|
|||||||
|
|
||||||
pp = stream_get_endp (s);
|
pp = stream_get_endp (s);
|
||||||
stream_forward_endp (s, OSPF_LS_UPD_MIN_SIZE);
|
stream_forward_endp (s, OSPF_LS_UPD_MIN_SIZE);
|
||||||
|
length += OSPF_LS_UPD_MIN_SIZE;
|
||||||
|
|
||||||
/* Calculate amount of packet usable for data. */
|
/* Calculate amount of packet usable for data. */
|
||||||
size_noauth = stream_get_size(s) - ospf_packet_authspace(oi);
|
size_noauth = stream_get_size(s) - ospf_packet_authspace(oi);
|
||||||
@ -3298,7 +3299,6 @@ ospf_ls_upd_packet_new (struct list *update, struct ospf_interface *oi)
|
|||||||
else
|
else
|
||||||
size = oi->ifp->mtu;
|
size = oi->ifp->mtu;
|
||||||
|
|
||||||
/* XXX Should this be - sizeof(struct ip)?? -gdt */
|
|
||||||
if (size > OSPF_MAX_PACKET_SIZE)
|
if (size > OSPF_MAX_PACKET_SIZE)
|
||||||
{
|
{
|
||||||
zlog_warn ("ospf_ls_upd_packet_new: oversized LSA id:%s too big,"
|
zlog_warn ("ospf_ls_upd_packet_new: oversized LSA id:%s too big,"
|
||||||
@ -3310,7 +3310,16 @@ ospf_ls_upd_packet_new (struct list *update, struct ospf_interface *oi)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ospf_packet_new (size);
|
/* IP header is built up separately by ospf_write(). This means, that we must
|
||||||
|
* reduce the "affordable" size just calculated by length of an IP header.
|
||||||
|
* This makes sure, that even if we manage to fill the payload with LSA data
|
||||||
|
* completely, the final packet (our data plus IP header) still fits into
|
||||||
|
* outgoing interface MTU. This correction isn't really meaningful for an
|
||||||
|
* oversized LSA, but for consistency the correction is done for both cases.
|
||||||
|
*
|
||||||
|
* P.S. OSPF_MAX_PACKET_SIZE above already includes IP header size
|
||||||
|
*/
|
||||||
|
return ospf_packet_new (size - sizeof (struct ip));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user