From 272ca1e33016b1cbf9c72038d5e631b0adb04dc9 Mon Sep 17 00:00:00 2001 From: Denis Ovsienko Date: Sun, 15 Jan 2012 19:12:19 +0400 Subject: ospfd: use LOOKUP() for ospf_packet_type_str * ospf_packet.h: add proper str/max extern declarations * ospf_packet.c * ospf_packet_type_str: rewrite in "struct message", add max value * ospf_packet_add(): use LOOKUP() * ospf_write(): ditto * ospf_hello(): ditto * ospf_read(): ditto * ospf_dump.h: the declaration does not belong here * ospf_dump.c * ospf_header_dump(): use LOOKUP() * show_debugging_ospf(): ditto --- ospfd/ospf_packet.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'ospfd/ospf_packet.h') diff --git a/ospfd/ospf_packet.h b/ospfd/ospf_packet.h index 9a472081..2115f111 100644 --- a/ospfd/ospf_packet.h +++ b/ospfd/ospf_packet.h @@ -163,4 +163,7 @@ extern int ospf_ls_ack_timer (struct thread *); extern int ospf_poll_timer (struct thread *); extern int ospf_hello_reply_timer (struct thread *); +extern const struct message ospf_packet_type_str[]; +extern const size_t ospf_packet_type_str_max; + #endif /* _ZEBRA_OSPF_PACKET_H */ -- cgit v1.2.1 From 75c8eabbb5d3dc8aa21b61e8700ab939ce272f5c Mon Sep 17 00:00:00 2001 From: Denis Ovsienko Date: Mon, 30 Jan 2012 15:41:39 +0400 Subject: ospfd: introduce ospf_packet_minlen[] (BZ#705) This commit ports some of the OSPFv3 packet reception checks to OSPFv2. * ospf_packet.c * ospf_packet_minlen[]: a direct equivalent of ospf6_packet_minlen[] * ospf_packet_examin(): new function designed after the first part of ospf6_packet_examin() * ospf_read(): verify received packet with ospf_packet_examin() * ospf_packet.h: add convenience macros --- ospfd/ospf_packet.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'ospfd/ospf_packet.h') diff --git a/ospfd/ospf_packet.h b/ospfd/ospf_packet.h index 2115f111..3cbe8897 100644 --- a/ospfd/ospf_packet.h +++ b/ospfd/ospf_packet.h @@ -46,6 +46,10 @@ #define OSPF_HELLO_REPLY_DELAY 1 +/* Return values of functions involved in packet verification, see ospf6d. */ +#define MSG_OK 0 +#define MSG_NG 1 + struct ospf_packet { struct ospf_packet *next; -- cgit v1.2.1 From 4e31de792ec5e48a97360b5b86196b4fa02996a3 Mon Sep 17 00:00:00 2001 From: Denis Ovsienko Date: Fri, 17 Feb 2012 16:20:50 +0400 Subject: ospfd: introduce ospf_lsa_minlen[] (BZ#705) This commit ports more packet checks to OSPFv2, in particular, LSA size verification and Router-LSA link blocks verification. * ospf_lsa.h: add LSA size macros * ospf_packet.h: add struct ospf_ls_update * ospf_packet.c * ospf_lsa_minlen[]: a direct equivalent of ospf6_lsa_minlen[] * ospf_router_lsa_links_examin(): new function, verifies trailing part of a Router-LSA * ospf_lsa_examin(): new function like ospf6_lsa_examin() * ospf_lsaseq_examin(): new function like ospf6_lsaseq_examin() * ospf_packet_examin(): add type-specific deeper level checks --- ospfd/ospf_packet.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'ospfd/ospf_packet.h') diff --git a/ospfd/ospf_packet.h b/ospfd/ospf_packet.h index 3cbe8897..337686ad 100644 --- a/ospfd/ospf_packet.h +++ b/ospfd/ospf_packet.h @@ -121,6 +121,10 @@ struct ospf_db_desc u_int32_t dd_seqnum; }; +struct ospf_ls_update +{ + u_int32_t num_lsas; +}; /* Macros. */ /* XXX Perhaps obsolete; function in ospf_packet.c */ -- cgit v1.2.1