diff options
author | paul <paul> | 2004-06-11 11:27:03 +0000 |
---|---|---|
committer | paul <paul> | 2004-06-11 11:27:03 +0000 |
commit | 02ff83c52592427623db0d8367ca9b3395fa321f (patch) | |
tree | 0aa278809140486f55012a98616106fc995d91e6 | |
parent | 51a8798e8d36dddfdeb6b0bfd01bf32a646e8bb1 (diff) |
2004-06-11 Sowmini Varadhan <sowmini.varadhan@sun.com>
* filter.c: (access_list_remark_cmd) buffer_putstr doesnt need cast
to u_char. (ipv6_access_list_remark_cmd) ditto.
if.c: ditto
* network.c: (readn/writen) pointer arg should be type u_char.
* plist.c: needs to include stream.h, not declare stream functions
internally.
(various) Add static qualifier to internal functions.
(prefix_list_type_str) extraneous breaks in switch statement.
(ip_prefix_list_description_cmd) buffer_putstr doesnt need cast
* stream.h: depends on plist.h and export stream_put_prefix
* vty.c: (vty_<telnet option build functions>) should use
unsigned char, telnet options are 0 -> 255.
* zclient.c: various u_char<->char type cleanups.
* zebra.h: Having to define CMSG_* can apply to more than just
BSDI_NRL.
* ripd.c: (rip_distribute_update_all) distribute list hook
function pointer prototype requires struct prefix_list * arg.
(rip_distribute_update_all_wrapper) update to pass required arg,
NULL.
-rw-r--r-- | lib/ChangeLog | 18 | ||||
-rw-r--r-- | lib/filter.c | 4 | ||||
-rw-r--r-- | lib/if.c | 2 | ||||
-rw-r--r-- | lib/network.c | 4 | ||||
-rw-r--r-- | lib/network.h | 4 | ||||
-rw-r--r-- | lib/plist.c | 76 | ||||
-rw-r--r-- | lib/stream.h | 3 | ||||
-rw-r--r-- | lib/vty.c | 10 | ||||
-rw-r--r-- | lib/zclient.c | 4 | ||||
-rw-r--r-- | lib/zebra.h | 27 | ||||
-rw-r--r-- | ripd/ChangeLog | 7 | ||||
-rw-r--r-- | ripd/ripd.c | 5 |
12 files changed, 101 insertions, 63 deletions
diff --git a/lib/ChangeLog b/lib/ChangeLog index 3573ac12..ab390734 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,21 @@ +2004-06-11 Sowmini Varadhan <sowmini.varadhan@sun.com> + + * filter.c: (access_list_remark_cmd) buffer_putstr doesnt need cast + to u_char. (ipv6_access_list_remark_cmd) ditto. + if.c: ditto + * network.c: (readn/writen) pointer arg should be type u_char. + * plist.c: needs to include stream.h, not declare stream functions + internally. + (various) Add static qualifier to internal functions. + (prefix_list_type_str) extraneous breaks in switch statement. + (ip_prefix_list_description_cmd) buffer_putstr doesnt need cast + * stream.h: depends on plist.h and export stream_put_prefix + * vty.c: (vty_<telnet option build functions>) should use + unsigned char, telnet options are 0 -> 255. + * zclient.c: various u_char<->char type cleanups. + * zebra.h: Having to define CMSG_* can apply to more than just + BSDI_NRL. + 2004-06-09 Paul Jakma <paul@dishone.st> * config.h: __attribute__ is a gcc'ism diff --git a/lib/filter.c b/lib/filter.c index a483ce23..cd4bc0a5 100644 --- a/lib/filter.c +++ b/lib/filter.c @@ -1374,7 +1374,7 @@ DEFUN (access_list_remark, b = buffer_new (1024); for (i = 1; i < argc; i++) { - buffer_putstr (b, (u_char *)argv[i]); + buffer_putstr (b, argv[i]); buffer_putc (b, ' '); } buffer_putc (b, '\0'); @@ -1556,7 +1556,7 @@ DEFUN (ipv6_access_list_remark, b = buffer_new (1024); for (i = 1; i < argc; i++) { - buffer_putstr (b, (u_char *)argv[i]); + buffer_putstr (b, argv[i]); buffer_putc (b, ' '); } buffer_putc (b, '\0'); @@ -462,7 +462,7 @@ DEFUN (interface_desc, b = buffer_new (1024); for (i = 0; i < argc; i++) { - buffer_putstr (b, (u_char *)argv[i]); + buffer_putstr (b, argv[i]); buffer_putc (b, ' '); } buffer_putc (b, '\0'); diff --git a/lib/network.c b/lib/network.c index b68761bc..d105db48 100644 --- a/lib/network.c +++ b/lib/network.c @@ -24,7 +24,7 @@ /* Read nbytes from fd and store into ptr. */ int -readn (int fd, char *ptr, int nbytes) +readn (int fd, u_char *ptr, int nbytes) { int nleft; int nread; @@ -50,7 +50,7 @@ readn (int fd, char *ptr, int nbytes) /* Write nbytes from ptr to fd. */ int -writen(int fd, char *ptr, int nbytes) +writen(int fd, u_char *ptr, int nbytes) { int nleft; int nwritten; diff --git a/lib/network.h b/lib/network.h index a0212950..0544361f 100644 --- a/lib/network.h +++ b/lib/network.h @@ -23,7 +23,7 @@ #ifndef _ZEBRA_NETWORK_H #define _ZEBRA_NETWORK_H -int readn (int, char *, int); -int writen (int, char *, int); +int readn (int, u_char *, int); +int writen (int, u_char *, int); #endif /* _ZEBRA_NETWORK_H */ diff --git a/lib/plist.c b/lib/plist.c index c2aeea5b..4069f861 100644 --- a/lib/plist.c +++ b/lib/plist.c @@ -27,6 +27,7 @@ #include "plist.h" #include "sockunion.h" #include "buffer.h" +#include "stream.h" /* Each prefix-list's entry. */ struct prefix_list_entry @@ -109,7 +110,7 @@ static struct prefix_master prefix_master_orf = NULL, }; -struct prefix_master * +static struct prefix_master * prefix_master_get (afi_t afi) { if (afi == AFI_IP) @@ -148,7 +149,7 @@ prefix_list_lookup (afi_t afi, char *name) return NULL; } -struct prefix_list * +static struct prefix_list * prefix_list_new () { struct prefix_list *new; @@ -157,13 +158,13 @@ prefix_list_new () return new; } -void +static void prefix_list_free (struct prefix_list *plist) { XFREE (MTYPE_PREFIX_LIST, plist); } -struct prefix_list_entry * +static struct prefix_list_entry * prefix_list_entry_new () { struct prefix_list_entry *new; @@ -172,7 +173,7 @@ prefix_list_entry_new () return new; } -void +static void prefix_list_entry_free (struct prefix_list_entry *pentry) { XFREE (MTYPE_PREFIX_LIST_ENTRY, pentry); @@ -180,7 +181,7 @@ prefix_list_entry_free (struct prefix_list_entry *pentry) /* Insert new prefix list to list of prefix_list. Each prefix_list is sorted by the name. */ -struct prefix_list * +static struct prefix_list * prefix_list_insert (afi_t afi, char *name) { int i; @@ -270,7 +271,7 @@ prefix_list_insert (afi_t afi, char *name) return plist; } -struct prefix_list * +static struct prefix_list * prefix_list_get (afi_t afi, char *name) { struct prefix_list *plist; @@ -283,7 +284,7 @@ prefix_list_get (afi_t afi, char *name) } /* Delete prefix-list from prefix_list_master and free it. */ -void +static void prefix_list_delete (struct prefix_list *plist) { struct prefix_list_list *list; @@ -332,7 +333,7 @@ prefix_list_delete (struct prefix_list *plist) (*master->delete_hook) (); } -struct prefix_list_entry * +static struct prefix_list_entry * prefix_list_entry_make (struct prefix *prefix, enum prefix_list_type type, int seq, int le, int ge, int any) { @@ -373,7 +374,7 @@ prefix_list_delete_hook (void (*func) (struct prefix_list *plist)) } /* Calculate new sequential number. */ -int +static int prefix_new_seq_get (struct prefix_list *plist) { int maxseq; @@ -394,7 +395,7 @@ prefix_new_seq_get (struct prefix_list *plist) } /* Return prefix list entry which has same seq number. */ -struct prefix_list_entry * +static struct prefix_list_entry * prefix_seq_check (struct prefix_list *plist, int seq) { struct prefix_list_entry *pentry; @@ -405,7 +406,7 @@ prefix_seq_check (struct prefix_list *plist, int seq) return NULL; } -struct prefix_list_entry * +static struct prefix_list_entry * prefix_list_entry_lookup (struct prefix_list *plist, struct prefix *prefix, enum prefix_list_type type, int seq, int le, int ge) { @@ -428,7 +429,7 @@ prefix_list_entry_lookup (struct prefix_list *plist, struct prefix *prefix, return NULL; } -void +static void prefix_list_entry_delete (struct prefix_list *plist, struct prefix_list_entry *pentry, int update_list) @@ -460,7 +461,7 @@ prefix_list_entry_delete (struct prefix_list *plist, } } -void +static void prefix_list_entry_add (struct prefix_list *plist, struct prefix_list_entry *pentry) { @@ -523,17 +524,14 @@ prefix_list_type_str (struct prefix_list_entry *pentry) { case PREFIX_PERMIT: return "permit"; - break; case PREFIX_DENY: return "deny"; - break; default: return ""; - break; } } -int +static int prefix_list_entry_match (struct prefix_list_entry *pentry, struct prefix *p) { int ret; @@ -624,7 +622,7 @@ prefix_list_print (struct prefix_list *plist) } /* Retrun 1 when plist already include pentry policy. */ -struct prefix_list_entry * +static struct prefix_list_entry * prefix_entry_dup_check (struct prefix_list *plist, struct prefix_list_entry *new) { @@ -648,7 +646,7 @@ prefix_entry_dup_check (struct prefix_list *plist, return NULL; } -int +static int vty_invalid_prefix_range (struct vty *vty, char *prefix) { vty_out (vty, "%% Invalid prefix range for %s, make sure: len < ge-value <= le-value%s", @@ -656,7 +654,7 @@ vty_invalid_prefix_range (struct vty *vty, char *prefix) return CMD_WARNING; } -int +static int vty_prefix_list_install (struct vty *vty, afi_t afi, char *name, char *seq, char *typestr, char *prefix, char *ge, char *le) @@ -775,7 +773,7 @@ vty_prefix_list_install (struct vty *vty, afi_t afi, return CMD_SUCCESS; } -int +static int vty_prefix_list_uninstall (struct vty *vty, afi_t afi, char *name, char *seq, char *typestr, char *prefix, char *ge, char *le) @@ -879,7 +877,7 @@ vty_prefix_list_uninstall (struct vty *vty, afi_t afi, return CMD_SUCCESS; } -int +static int vty_prefix_list_desc_unset (struct vty *vty, afi_t afi, char *name) { struct prefix_list *plist; @@ -913,7 +911,7 @@ enum display_type first_match_display }; -void +static void vty_show_prefix_entry (struct vty *vty, afi_t afi, struct prefix_list *plist, struct prefix_master *master, enum display_type dtype, int seqnum) @@ -983,7 +981,7 @@ vty_show_prefix_entry (struct vty *vty, afi_t afi, struct prefix_list *plist, } } -int +static int vty_show_prefix_list (struct vty *vty, afi_t afi, char *name, char *seq, enum display_type dtype) { @@ -1027,7 +1025,7 @@ vty_show_prefix_list (struct vty *vty, afi_t afi, char *name, return CMD_SUCCESS; } -int +static int vty_show_prefix_list_prefix (struct vty *vty, afi_t afi, char *name, char *prefix, enum display_type type) { @@ -1099,7 +1097,7 @@ vty_show_prefix_list_prefix (struct vty *vty, afi_t afi, char *name, return CMD_SUCCESS; } -int +static int vty_clear_prefix_list (struct vty *vty, afi_t afi, char *name, char *prefix) { struct prefix_master *master; @@ -1577,7 +1575,7 @@ DEFUN (ip_prefix_list_description, b = buffer_new (1024); for (i = 1; i < argc; i++) { - buffer_putstr (b, (u_char *)argv[i]); + buffer_putstr (b, argv[i]); buffer_putc (b, ' '); } buffer_putc (b, '\0'); @@ -2187,7 +2185,7 @@ DEFUN (ipv6_prefix_list_description, b = buffer_new (1024); for (i = 1; i < argc; i++) { - buffer_putstr (b, (u_char *)argv[i]); + buffer_putstr (b, argv[i]); buffer_putc (b, ' '); } buffer_putc (b, '\0'); @@ -2374,7 +2372,7 @@ DEFUN (clear_ipv6_prefix_list_name_prefix, #endif /* HAVE_IPV6 */ /* Configuration write function. */ -int +static int config_write_prefix_afi (afi_t afi, struct vty *vty) { struct prefix_list *plist; @@ -2481,10 +2479,6 @@ config_write_prefix_afi (afi_t afi, struct vty *vty) return write; } -int stream_putc (struct stream *, u_char); -int stream_putl (struct stream *, u_int32_t); -int stream_put_prefix (struct stream *, struct prefix *); - struct stream * prefix_bgp_orf_entry (struct stream *s, struct prefix_list *plist, u_char init_flag, u_char permit_flag, u_char deny_flag) @@ -2610,7 +2604,7 @@ prefix_bgp_show_prefix_list (struct vty *vty, afi_t afi, char *name) return plist->count; } -void +static void prefix_list_reset_orf () { struct prefix_list *plist; @@ -2651,13 +2645,13 @@ struct cmd_node prefix_node = 1 }; -int +static int config_write_prefix_ipv4 (struct vty *vty) { return config_write_prefix_afi (AFI_IP, vty); } -void +static void prefix_list_reset_ipv4 () { struct prefix_list *plist; @@ -2689,7 +2683,7 @@ prefix_list_reset_ipv4 () master->recent = NULL; } -void +static void prefix_list_init_ipv4 () { install_node (&prefix_node, config_write_prefix_ipv4); @@ -2760,13 +2754,13 @@ struct cmd_node prefix_ipv6_node = 1 }; -int +static int config_write_prefix_ipv6 (struct vty *vty) { return config_write_prefix_afi (AFI_IP6, vty); } -void +static void prefix_list_reset_ipv6 () { struct prefix_list *plist; @@ -2798,7 +2792,7 @@ prefix_list_reset_ipv6 () master->recent = NULL; } -void +static void prefix_list_init_ipv6 () { install_node (&prefix_ipv6_node, config_write_prefix_ipv6); diff --git a/lib/stream.h b/lib/stream.h index c6ef3c81..f7a94ea3 100644 --- a/lib/stream.h +++ b/lib/stream.h @@ -23,6 +23,8 @@ #ifndef _ZEBRA_STREAM_H #define _ZEBRA_STREAM_H +#include "prefix.h" + /* Stream buffer. */ struct stream { @@ -82,6 +84,7 @@ int stream_putl (struct stream *, u_int32_t); int stream_putl_at (struct stream *, unsigned long, u_int32_t); int stream_put_ipv4 (struct stream *, u_int32_t); int stream_put_in_addr (struct stream *, struct in_addr *); +int stream_put_prefix (struct stream *, struct prefix *); void stream_get (void *, struct stream *, size_t); u_char stream_getc (struct stream *); @@ -221,7 +221,7 @@ vty_prompt (struct vty *vty) void vty_will_echo (struct vty *vty) { - char cmd[] = { IAC, WILL, TELOPT_ECHO, '\0' }; + unsigned char cmd[] = { IAC, WILL, TELOPT_ECHO, '\0' }; vty_out (vty, "%s", cmd); } @@ -229,7 +229,7 @@ vty_will_echo (struct vty *vty) static void vty_will_suppress_go_ahead (struct vty *vty) { - char cmd[] = { IAC, WILL, TELOPT_SGA, '\0' }; + unsigned char cmd[] = { IAC, WILL, TELOPT_SGA, '\0' }; vty_out (vty, "%s", cmd); } @@ -237,7 +237,7 @@ vty_will_suppress_go_ahead (struct vty *vty) static void vty_dont_linemode (struct vty *vty) { - char cmd[] = { IAC, DONT, TELOPT_LINEMODE, '\0' }; + unsigned char cmd[] = { IAC, DONT, TELOPT_LINEMODE, '\0' }; vty_out (vty, "%s", cmd); } @@ -245,7 +245,7 @@ vty_dont_linemode (struct vty *vty) static void vty_do_window_size (struct vty *vty) { - char cmd[] = { IAC, DO, TELOPT_NAWS, '\0' }; + unsigned char cmd[] = { IAC, DO, TELOPT_NAWS, '\0' }; vty_out (vty, "%s", cmd); } @@ -254,7 +254,7 @@ vty_do_window_size (struct vty *vty) static void vty_dont_lflow_ahead (struct vty *vty) { - char cmd[] = { IAC, DONT, TELOPT_LFLOW, '\0' }; + unsigned char cmd[] = { IAC, DONT, TELOPT_LFLOW, '\0' }; vty_out (vty, "%s", cmd); } #endif /* 0 */ diff --git a/lib/zclient.c b/lib/zclient.c index dcfa45f4..3b683387 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -512,7 +512,7 @@ struct interface * zebra_interface_add_read (struct stream *s) { struct interface *ifp; - u_char ifname_tmp[INTERFACE_NAMSIZ]; + char ifname_tmp[INTERFACE_NAMSIZ]; /* Read interface name. */ stream_get (ifname_tmp, s, INTERFACE_NAMSIZ); @@ -556,7 +556,7 @@ struct interface * zebra_interface_state_read (struct stream *s) { struct interface *ifp; - u_char ifname_tmp[INTERFACE_NAMSIZ]; + char ifname_tmp[INTERFACE_NAMSIZ]; /* Read interface name. */ stream_get (ifname_tmp, s, INTERFACE_NAMSIZ); diff --git a/lib/zebra.h b/lib/zebra.h index ed3024db..7ba01d56 100644 --- a/lib/zebra.h +++ b/lib/zebra.h @@ -207,14 +207,29 @@ typedef int socklen_t; #define IN6_ARE_ADDR_EQUAL IN6_IS_ADDR_EQUAL -/* BSD/OS 4.0 has lost belows defines, it should appear at - /usr/include/sys/socket.h. */ -#define CMSG_ALIGN(n) (((n) + 3) & ~3) -#define CMSG_SPACE(l) (CMSG_ALIGN(sizeof(struct cmsghdr)) + CMSG_ALIGN(l)) -#define CMSG_LEN(l) (CMSG_ALIGN(sizeof(struct cmsghdr)) + (l)) - #endif /* BSDI_NRL */ +/* + * RFC 2553-bis defines not available on some systems. + */ +#ifndef _CMSG_DATA_ALIGN +#define _CMSG_DATA_ALIGN(n) (((n) + 3) & ~3) +#endif /* _CMSG_DATA_ALIGN */ + +#ifndef _CMSG_HDR_ALIGN +#define _CMSG_HDR_ALIGN(n) (((n) + 3) & ~3) +#endif /* _CMSG_HDR_ALIGN */ + +#ifndef CMSG_SPACE +#define CMSG_SPACE(l) (_CMSG_DATA_ALIGN(sizeof(struct cmsghdr)) + \ + _CMSG_HDR_ALIGN(l)) +#endif /* CMSG_SPACE */ + + +#ifndef CMSG_LEN +#define CMSG_LEN(l) (_CMSG_DATA_ALIGN(sizeof(struct cmsghdr)) + (l)) +#endif /* CMSG_LEN */ + #if !defined(__GNUC__) || __GNUC__ < 2 || __GNUC_MINOR__ < 5 #define __attribute__(x) #endif /* !__GNUC__ */ diff --git a/ripd/ChangeLog b/ripd/ChangeLog index 848efee4..20803338 100644 --- a/ripd/ChangeLog +++ b/ripd/ChangeLog @@ -1,3 +1,10 @@ +2004-06-11 Sowmini Varadhan <sowmini.varadhan@sun.com> + + * ripd.c: (rip_distribute_update_all) distribute list hook + function pointer prototype requires struct prefix_list * arg. + (rip_distribute_update_all_wrapper) update to pass required arg, + NULL. + 2004-06-06 Paul Jakma <paul.jakma@sun.com> * ripd.h: Add define for the RIPv2 Authentication Data family diff --git a/ripd/ripd.c b/ripd/ripd.c index 69148227..8b76073c 100644 --- a/ripd/ripd.c +++ b/ripd/ripd.c @@ -3745,8 +3745,9 @@ rip_distribute_update_interface (struct interface *ifp) } /* Update all interface's distribute list. */ +/* ARGSUSED */ void -rip_distribute_update_all () +rip_distribute_update_all (struct prefix_list *notused) { struct interface *ifp; listnode node; @@ -3761,7 +3762,7 @@ rip_distribute_update_all () void rip_distribute_update_all_wrapper(struct access_list *notused) { - rip_distribute_update_all(); + rip_distribute_update_all(NULL); } /* Delete all added rip route. */ |