summaryrefslogtreecommitdiff
path: root/lib/if.h
diff options
context:
space:
mode:
authorajs <ajs>2005-04-02 22:50:38 +0000
committerajs <ajs>2005-04-02 22:50:38 +0000
commita349198fd3e4e5692cdc91223f8153cb53c086ce (patch)
treee5b366a8ab7ab9ed1c9670faf1f18eef26877ade /lib/if.h
parentf695b01ff8e9aebc46bdf41f104ad4abbb0ef59e (diff)
2005-04-02 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* if.h: (if_lookup_by_name_len, if_get_by_name_len) New functions. * if.c: (if_lookup_by_name_len, if_get_by_name_len) New functions. (if_get_by_name) Tighten up code. (interface) Use new function if_get_by_name_len. * zclient.c: (zebra_interface_add_read) Use new if_get_by_name_len function. (zebra_interface_state_read) Use new if_lookup_by_name_len function. * kernel_socket.c: (ifm_read) Use new if_lookup_by_name_len function to save a memcpy. * if_ioctl_solaris.c: (interface_list_ioctl) Fix subtle bug with new if_get_by_name_len function. * ospf_interface.c: (ospf_vl_new) Use strnlen to fix call to if_create.
Diffstat (limited to 'lib/if.h')
-rw-r--r--lib/if.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/if.h b/lib/if.h
index df9ff605..4cfc9e77 100644
--- a/lib/if.h
+++ b/lib/if.h
@@ -214,11 +214,25 @@ struct connected
int if_cmp_func (struct interface *, struct interface *);
struct interface *if_create (const char *name, int namelen);
struct interface *if_lookup_by_index (unsigned int);
-struct interface *if_lookup_by_name (const char *);
struct interface *if_lookup_exact_address (struct in_addr);
struct interface *if_lookup_address (struct in_addr);
+
+/* Currently, the code assumes that the interface name arguments to these
+ functions have length <= INTERFACE_NAMSIZ, and they must be NUL-terminated
+ if they are shorter than INTERFACE_NAMSIZ. After code cleanup, the
+ implementation will be changed to require the arguments to these functions
+ to terminate with a NUL character (no length limitation). */
+struct interface *if_lookup_by_name (const char *);
struct interface *if_get_by_name (const char *);
+/* For these 2 functions, the 2nd argument should be the precise length
+ of the interface name (not counting a trailing NUL which may or may
+ not be present). */
+extern struct interface *if_lookup_by_name_len(const char *name,
+ size_t namelen);
+extern struct interface *if_get_by_name_len(const char *name, size_t namelen);
+
+
/* Delete the interface, but do not free the structure, and leave it in the
interface list. It is often advisable to leave the pseudo interface
structure because there may be configuration information attached. */