* (global) Const char update and signed/unsigned fixes.
* (various headers) size defines should be unsigned.
* ospf_interface.h: remove duplicated defines, include the
authoritative header - though, these defines should probably
be moved to a dedicated header, or ospfd.h.
* ospf_lsa.h: (struct lsa) ls_seqnum should be unsigned.
* ospf_packet.c: (ospf_write) cast result of shift to unsigned.
(ospf_recv_packet) ip_len is needed for old OpenBSD fixup.
(ospf_read) sockopt_iphdrincl_swab_systoh ip header as soon as
we have it.
+ * (global) Const char update and signed/unsigned fixes.
+ * (various headers) size defines should be unsigned.
+ * ospf_interface.h: remove duplicated defines, include the
+ authoritative header - though, these defines should probably
+ be moved to a dedicated header, or ospfd.h.
+ * ospf_lsa.h: (struct lsa) ls_seqnum should be unsigned.
+ * ospf_packet.c: (ospf_write) cast result of shift to unsigned.
2004-10-08 Hasso Tepper <hasso at quagga.net>
if (IS_DEBUG_OSPF_EVENT)
zlog_info ("ospf_abr_update_aggregate(): Start");
- if (range->cost_config != -1)
+ if (range->cost_config != OSPF_AREA_RANGE_COST_UNSPEC)
{
if (IS_DEBUG_OSPF_EVENT)
zlog_info ("ospf_abr_update_aggregate(): use configured cost %d",
/* Configured range cost. */
u_int32_t cost_config;
-#define OSPF_AREA_RANGE_COST_UNSPEC -1
+#define OSPF_AREA_RANGE_COST_UNSPEC -1U
};
/* Prototypes. */
struct ospf_area_range *ospf_area_range_match_any (struct ospf *,
struct prefix_ipv4 *);
int ospf_area_range_active (struct ospf_area_range *);
-int ospf_act_bb_connection ();
+int ospf_act_bb_connection (struct ospf *);
-void ospf_check_abr_status ();
-void ospf_abr_task ();
-void ospf_schedule_abr_task ();
+void ospf_check_abr_status (struct ospf *);
+void ospf_abr_task (struct ospf *);
+void ospf_schedule_abr_task (struct ospf *);
#endif /* _ZEBRA_OSPF_ABR_H */
#ifndef _ZEBRA_OSPF_INTERFACE_H
#define _ZEBRA_OSPF_INTERFACE_H
-#define OSPF_AUTH_SIMPLE_SIZE 8
-#define OSPF_AUTH_MD5_SIZE 16
+#include "ospfd/ospf_packet.h"
#define IF_OSPF_IF_INFO(I) ((struct ospf_if_info *)((I)->info))
#define IF_DEF_PARAMS(I) (IF_OSPF_IF_INFO (I)->def_params)
#define OSPF_OPAQUE_AREA_LSA 10
#define OSPF_OPAQUE_AS_LSA 11
-#define OSPF_LSA_HEADER_SIZE 20
-#define OSPF_MAX_LSA_SIZE 1500
+#define OSPF_LSA_HEADER_SIZE 20U
+#define OSPF_MAX_LSA_SIZE 1500U
/* AS-external-LSA refresh method. */
#define LSA_REFRESH_IF_CHANGED 0
u_char type;
struct in_addr id;
struct in_addr adv_router;
- int ls_seqnum;
+ u_int32_t ls_seqnum;
u_int16_t checksum;
u_int16_t length;
};
return new;
}
-int
+unsigned int
ospf_packet_max (struct ospf_interface *oi)
{
int max;
ospf_check_md5_digest (struct ospf_interface *oi, struct stream *s,
u_int16_t length)
{
- void *ibuf;
+ unsigned char *ibuf;
struct md5_ctx ctx;
unsigned char digest[OSPF_AUTH_MD5_SIZE];
unsigned char *pdigest;
void
ospf_write_frags (int fd, struct ospf_packet *op, struct ip *iph,
struct msghdr *msg, struct iovec **iov,
- int maxdatasize, int mtu, int flags)
+ unsigned int maxdatasize,
+ unsigned int mtu, int flags)
{
#define OSPF_WRITE_FRAG_SHIFT 3
u_int16_t offset;
iph.ip_hl = sizeof (struct ip) >> OSPF_WRITE_IPHL_SHIFT;
/* it'd be very strange for header to not be 4byte-word aligned but.. */
- if ( sizeof (struct ip) > (iph.ip_hl << OSPF_WRITE_IPHL_SHIFT) )
+ if ( sizeof (struct ip)
+ > (unsigned int)(iph.ip_hl << OSPF_WRITE_IPHL_SHIFT) )
iph.ip_hl++; /* we presume sizeof struct ip cant overflow ip_hl.. */
iph.ip_v = IPVERSION;
struct in_addr adv_router;
struct ospf_lsa *find;
struct list *ls_upd;
- int length;
+ unsigned int length;
/* Increment statistics. */
oi->ls_req_in++;
#ifndef _ZEBRA_OSPF_PACKET_H
#define _ZEBRA_OSPF_PACKET_H
-#define OSPF_HEADER_SIZE 24
-#define OSPF_AUTH_SIMPLE_SIZE 8
-#define OSPF_AUTH_MD5_SIZE 16
-
-#define OSPF_MAX_PACKET_SIZE 65535 /* includes IP Header size. */
-#define OSPF_HELLO_MIN_SIZE 20 /* not including neighbors */
-#define OSPF_DB_DESC_MIN_SIZE 8
-#define OSPF_LS_REQ_MIN_SIZE 0
-#define OSPF_LS_UPD_MIN_SIZE 4
-#define OSPF_LS_ACK_MIN_SIZE 0
+#define OSPF_HEADER_SIZE 24U
+#define OSPF_AUTH_SIMPLE_SIZE 8U
+#define OSPF_AUTH_MD5_SIZE 16U
+
+#define OSPF_MAX_PACKET_SIZE 65535U /* includes IP Header size. */
+#define OSPF_HELLO_MIN_SIZE 20U /* not including neighbors */
+#define OSPF_DB_DESC_MIN_SIZE 8U
+#define OSPF_LS_REQ_MIN_SIZE 0U
+#define OSPF_LS_UPD_MIN_SIZE 4U
+#define OSPF_LS_ACK_MIN_SIZE 0U
#define OSPF_MSG_HELLO 1 /* OSPF Hello Message. */
#define OSPF_MSG_DB_DESC 2 /* OSPF Database Descriptoin Message. */
/* Hook function for updating route_map assignment. */
void
-ospf_route_map_update (char *name)
+ospf_route_map_update (const char *name)
{
struct ospf *ospf;
int type;
}
void
-ospf_route_map_event (route_map_event_t event, char *name)
+ospf_route_map_event (route_map_event_t event, const char *name)
{
struct ospf *ospf;
int type;
/* Delete rip route map rule. */
int
ospf_route_match_delete (struct vty *vty, struct route_map_index *index,
- const char *command, char *arg)
+ const char *command, const char *arg)
{
int ret;
int
ospf_route_match_add (struct vty *vty, struct route_map_index *index,
- const char *command, char *arg)
+ const char *command, const char *arg)
{
int ret;
int
ospf_route_set_add (struct vty *vty, struct route_map_index *index,
- const char *command, char *arg)
+ const char *command, const char *arg)
{
int ret;
/* Delete rip route map rule. */
int
ospf_route_set_delete (struct vty *vty, struct route_map_index *index,
- const char *command, char *arg)
+ const char *command, const char *arg)
{
int ret;
/* Route map `ip next-hop' match statement. `arg' should be
access-list name. */
void *
-route_match_ip_nexthop_compile (char *arg)
+route_match_ip_nexthop_compile (const char *arg)
{
return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg);
}
}
void *
-route_match_ip_next_hop_prefix_list_compile (char *arg)
+route_match_ip_next_hop_prefix_list_compile (const char *arg)
{
return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg);
}
/* Route map `ip address' match statement. `arg' should be
access-list name. */
void *
-route_match_ip_address_compile (char *arg)
+route_match_ip_address_compile (const char *arg)
{
return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg);
}
}
void *
-route_match_ip_address_prefix_list_compile (char *arg)
+route_match_ip_address_prefix_list_compile (const char *arg)
{
return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg);
}
/* Route map `interface' match statement. `arg' should be
interface name. */
void *
-route_match_interface_compile (char *arg)
+route_match_interface_compile (const char *arg)
{
return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg);
}
/* set metric compilation. */
void *
-route_set_metric_compile (char *arg)
+route_set_metric_compile (const char *arg)
{
u_int32_t *metric;
/* set metric-type compilation. */
void *
-route_set_metric_type_compile (char *arg)
+route_set_metric_type_compile (const char *arg)
{
u_int32_t *metric_type;
struct ospf *ospf;
struct ospf_area *area;
struct ospf_lsa *lsa;
- int len;
+ unsigned int len;
int type_next;
int ls_id_next;
int router_id_next;
{
oid *offset;
int offsetlen;
- int len;
+ unsigned int len;
struct ospf *ospf;
struct ospf_area *area;
struct ospf_area_range *range;
ospfIfLookup (struct variable *v, oid *name, size_t *length,
struct in_addr *ifaddr, unsigned int *ifindex, int exact)
{
- int len;
+ unsigned int len;
int ifaddr_next = 0;
int ifindex_next = 0;
struct interface *ifp;
ospfIfMetricLookup (struct variable *v, oid *name, size_t *length,
struct in_addr *ifaddr, unsigned int *ifindex, int exact)
{
- int len;
+ unsigned int len;
int ifaddr_next = 0;
int ifindex_next = 0;
struct interface *ifp;
struct in_addr *area_id, struct in_addr *neighbor, int exact)
{
int first;
- int len;
+ unsigned int len;
struct ospf_vl_data *vl_data;
if (exact)
ospfNbrLookup (struct variable *v, oid *name, size_t *length,
struct in_addr *nbr_addr, unsigned int *ifindex, int exact)
{
- int len;
+ unsigned int len;
int first;
struct ospf_neighbor *nbr;
struct ospf *ospf;
oid *offset;
int offsetlen;
u_char lsa_type;
- int len;
+ unsigned int len;
struct ospf_lsa *lsa;
struct ospf *ospf;
void
ospf_snmp_init ()
{
- struct ospf *ospf;
-
ospf_snmp_iflist = list_new ();
ospf_snmp_vl_table = route_table_init ();
smux_init (om->master, ospfd_oid, sizeof (ospfd_oid) / sizeof (oid));
{
struct listnode *node;
struct mpls_te_link *lp;
- int key = GET_OPAQUE_ID (ntohl (lsa->data->id.s_addr));
+ unsigned int key = GET_OPAQUE_ID (ntohl (lsa->data->id.s_addr));
LIST_LOOP (OspfMplsTE.iflist, lp, node)
if (lp->instance == key)
\f
/* Utility functions. */
int
-ospf_str2area_id (char *str, struct in_addr *area_id, int *format)
+ospf_str2area_id (const char *str, struct in_addr *area_id, int *format)
{
char *endptr = NULL;
unsigned long ret;
\f
int
-str2distribute_source (char *str, int *source)
+str2distribute_source (const char *str, int *source)
{
/* Sanity check. */
if (str == NULL)
}
int
-str2metric (char *str, int *metric)
+str2metric (const char *str, int *metric)
{
/* Sanity check. */
if (str == NULL)
}
int
-str2metric_type (char *str, int *metric_type)
+str2metric_type (const char *str, int *metric_type)
{
/* Sanity check. */
if (str == NULL)
}
int
-ospf_area_nssa_cmd_handler (struct vty *vty, int argc, char **argv, int nosum)
+ospf_area_nssa_cmd_handler (struct vty *vty, int argc, const char *argv[],
+ int nosum)
{
struct ospf *ospf = vty->index;
struct in_addr area_id;
vty_out (vty, " area %s range %s/%d", buf,
inet_ntoa (rn1->p.u.prefix4), rn1->p.prefixlen);
- if (range->cost_config != -1)
+ if (range->cost_config != OSPF_AREA_RANGE_COST_UNSPEC)
vty_out (vty, " cost %d", range->cost_config);
if (!CHECK_FLAG (range->flags, OSPF_AREA_RANGE_ADVERTISE))
/* OSPF route-map set for redistribution */
void
-ospf_routemap_set (struct ospf *ospf, int type, char *name)
+ospf_routemap_set (struct ospf *ospf, int type, const char *name)
{
if (ROUTEMAP_NAME (ospf, type))
free (ROUTEMAP_NAME (ospf, type));
\f
int
-ospf_distribute_list_out_set (struct ospf *ospf, int type, char *name)
+ospf_distribute_list_out_set (struct ospf *ospf, int type, const char *name)
{
/* Lookup access-list for distribute-list. */
DISTRIBUTE_LIST (ospf, type) = access_list_lookup (AFI_IP, name);
}
int
-ospf_distribute_list_out_unset (struct ospf *ospf, int type, char *name)
+ospf_distribute_list_out_unset (struct ospf *ospf, int type, const char *name)
{
/* Schedule update timer. */
if (DISTRIBUTE_LIST (ospf, type))
}
int
-ospf_distance_set (struct vty *vty, struct ospf *ospf, char *distance_str,
- char *ip_str, char *access_list_str)
+ospf_distance_set (struct vty *vty, struct ospf *ospf,
+ const char *distance_str,
+ const char *ip_str,
+ const char *access_list_str)
{
int ret;
struct prefix_ipv4 p;
}
int
-ospf_distance_unset (struct vty *vty, struct ospf *ospf, char *distance_str,
- char *ip_str, char *access_list_str)
+ospf_distance_unset (struct vty *vty, struct ospf *ospf,
+ const char *distance_str,
+ const char *ip_str, char
+ const *access_list_str)
{
int ret;
struct prefix_ipv4 p;
int ospf_default_originate_timer (struct thread *);
-int ospf_redistribute_check (struct external_info *, int *);
-int ospf_distribute_check_connected (struct external_info *);
-void ospf_distribute_list_update (int);
+int ospf_redistribute_check (struct ospf *, struct external_info *, int *);
+int ospf_distribute_check_connected (struct ospf *, struct external_info *);
+void ospf_distribute_list_update (struct ospf *, int);
int ospf_is_type_redistributed (int);
-int ospf_redistribute_unset (int);
-
-void ospf_distance_reset ();
+void ospf_distance_reset (struct ospf *);
u_char ospf_distance_apply (struct prefix_ipv4 *, struct ospf_route *);
struct vty;
-int ospf_redistribute_set (int, int, int);
-int ospf_redistribute_unset (int);
-int ospf_redistribute_default_set (int, int, int);
-int ospf_redistribute_default_unset ();
-int ospf_distribute_list_out_set (int, char *);
-int ospf_distribute_list_out_unset (int, char *);
-void ospf_routemap_set (int, char *);
-void ospf_routemap_unset (int);
-int ospf_distance_set (struct vty *, char *, char *, char *);
-int ospf_distance_unset (struct vty *, char *, char *, char *);
+int ospf_redistribute_set (struct ospf *, int, int, int);
+int ospf_redistribute_unset (struct ospf *, int);
+int ospf_redistribute_default_set (struct ospf *, int, int, int);
+int ospf_redistribute_default_unset (struct ospf *);
+int ospf_distribute_list_out_set (struct ospf *, int, const char *);
+int ospf_distribute_list_out_unset (struct ospf *, int, const char *);
+void ospf_routemap_set (struct ospf *, int, const char *);
+void ospf_routemap_unset (struct ospf *, int);
+int ospf_distance_set (struct vty *, struct ospf *, const char *, const char *, const char *);
+int ospf_distance_unset (struct vty *, struct ospf *, const char *, const char *, const char *);
void ospf_zebra_init ();
#endif /* _ZEBRA_OSPF_ZEBRA_H */
int
ospf_area_export_list_set (struct ospf *ospf,
- struct ospf_area *area, char *list_name)
+ struct ospf_area *area, const char *list_name)
{
struct access_list *list;
list = access_list_lookup (AFI_IP, list_name);
}
int
-ospf_area_import_list_set (struct ospf *ospf,
- struct ospf_area *area, char *name)
+ospf_area_import_list_set (struct ospf *ospf, struct ospf_area *area,
+ const char *name)
{
struct access_list *list;
list = access_list_lookup (AFI_IP, name);
int
ospf_nbr_nbma_poll_interval_set (struct ospf *ospf, struct in_addr nbr_addr,
- int interval)
+ unsigned int interval)
{
struct ospf_nbr_nbma *nbr_nbma;
int ospf_area_nssa_set (struct ospf *, struct in_addr);
int ospf_area_nssa_unset (struct ospf *, struct in_addr);
int ospf_area_nssa_translator_role_set (struct ospf *, struct in_addr, int);
-int ospf_area_export_list_set (struct ospf *, struct ospf_area *, char *);
+int ospf_area_export_list_set (struct ospf *, struct ospf_area *, const char *);
int ospf_area_export_list_unset (struct ospf *, struct ospf_area *);
-int ospf_area_import_list_set (struct ospf *, struct ospf_area *, char *);
+int ospf_area_import_list_set (struct ospf *, struct ospf_area *, const char *);
int ospf_area_import_list_unset (struct ospf *, struct ospf_area *);
int ospf_area_shortcut_set (struct ospf *, struct ospf_area *, int);
int ospf_area_shortcut_unset (struct ospf *, struct ospf_area *);
int ospf_nbr_nbma_unset (struct ospf *, struct in_addr);
int ospf_nbr_nbma_priority_set (struct ospf *, struct in_addr, u_char);
int ospf_nbr_nbma_priority_unset (struct ospf *, struct in_addr);
-int ospf_nbr_nbma_poll_interval_set (struct ospf *, struct in_addr, int);
+int ospf_nbr_nbma_poll_interval_set (struct ospf *, struct in_addr, unsigned int);
int ospf_nbr_nbma_poll_interval_unset (struct ospf *, struct in_addr);
void ospf_prefix_list_update (struct prefix_list *);
void ospf_init ();