#include "ospf6_flood.h"
#include "ospf6d.h"
+#include <netinet/ip6.h>
+
unsigned char conf_debug_ospf6_message[6] = {0x03, 0, 0, 0, 0, 0};
const char *ospf6_message_type_str[] =
{ "Unknown", "Hello", "DbDesc", "LSReq", "LSUpdate", "LSAck" };
zlog_err ("Could not send entire message");
}
+static int
+ospf6_packet_max(struct ospf6_interface *oi)
+{
+ return oi->ifmtu - sizeof(struct ip6_hdr);
+}
+
int
ospf6_hello_send (struct thread *thread)
{
if (on->state < OSPF6_NEIGHBOR_INIT)
continue;
- if (p - sendbuf + sizeof (u_int32_t) > oi->ifmtu)
+ if (p - sendbuf + sizeof (u_int32_t) > ospf6_packet_max(oi))
{
if (IS_OSPF6_DEBUG_MESSAGE (OSPF6_MESSAGE_TYPE_HELLO, SEND))
zlog_debug ("sending Hello message: exceeds I/F MTU");
/* MTU check */
if (p - sendbuf + sizeof (struct ospf6_lsa_header) >
- on->ospf6_if->ifmtu)
+ ospf6_packet_max(on->ospf6_if))
{
ospf6_lsa_unlock (lsa);
break;
for (lsa = ospf6_lsdb_head (on->summary_list); lsa;
lsa = ospf6_lsdb_next (lsa))
{
- if (size + sizeof (struct ospf6_lsa_header) > on->ospf6_if->ifmtu)
+ if (size + sizeof (struct ospf6_lsa_header) > ospf6_packet_max(on->ospf6_if))
{
ospf6_lsa_unlock (lsa);
break;
lsa = ospf6_lsdb_next (lsa))
{
/* MTU check */
- if (p - sendbuf + sizeof (struct ospf6_lsreq_entry) > on->ospf6_if->ifmtu)
+ if (p - sendbuf + sizeof (struct ospf6_lsreq_entry) > ospf6_packet_max(on->ospf6_if))
{
ospf6_lsa_unlock (lsa);
break;
{
/* MTU check */
if ( (p - sendbuf + (unsigned int)OSPF6_LSA_SIZE (lsa->header))
- > on->ospf6_if->ifmtu)
+ > ospf6_packet_max(on->ospf6_if))
{
ospf6_lsa_unlock (lsa);
break;
{
/* MTU check */
if ( (p - sendbuf + (unsigned int)OSPF6_LSA_SIZE (lsa->header))
- > on->ospf6_if->ifmtu)
+ > ospf6_packet_max(on->ospf6_if))
{
ospf6_lsa_unlock (lsa);
break;
{
/* MTU check */
if ( (p - sendbuf + ((unsigned int)OSPF6_LSA_SIZE (lsa->header)))
- > oi->ifmtu)
+ > ospf6_packet_max(oi))
{
ospf6_lsa_unlock (lsa);
break;
lsa = ospf6_lsdb_next (lsa))
{
/* MTU check */
- if (p - sendbuf + sizeof (struct ospf6_lsa_header) > on->ospf6_if->ifmtu)
+ if (p - sendbuf + sizeof (struct ospf6_lsa_header) > ospf6_packet_max(on->ospf6_if))
{
/* if we run out of packet size/space here,
better to try again soon. */
lsa = ospf6_lsdb_next (lsa))
{
/* MTU check */
- if (p - sendbuf + sizeof (struct ospf6_lsa_header) > oi->ifmtu)
+ if (p - sendbuf + sizeof (struct ospf6_lsa_header) > ospf6_packet_max(oi))
{
/* if we run out of packet size/space here,
better to try again soon. */