Age | Commit message (Collapse) | Author |
|
* getopt.h: Don't declare getopt (rather than getopt_long), since
quagga doesn't need it.
* getopt.c (getopt): Don't define getopt.
Fixes build breakage on NetBSD, and seems likely to work on most
platforms since it avoids the entire issue of system getopt
declarations and whether they conform to POSIX.2. Note that this
change doesn't address system getopt_long declarations, but also
doesn't change anything about getopt_long.
|
|
* prefix.c: (prefix_ipv4_new, prefix_ipv6_new): Call prefix_new
to allocate the memory to make sure that all struct prefix pointers
point to objects of the same length (avoids memory overruns
on struct prefix assignments).
(prefix_ipv4_free, prefix_ipv6_free): Simply call prefix_free.
It is interesting to note that these functions are never actually
called anywhere in the code. Instead prefix_free was already
being called directly, despite the previous MTYPE incompatibility.
[backport candidate]
|
|
* prefix.c: (ip_masklen) While loop should test that 'pnt' pointer is
in range before dereferencing it.
[backport candidate]
|
|
* getopt.h: add further tests for full getopt declaration on
various systems.
|
|
* memtypes.h: update autobuilt file to match memtypes.c changes
|
|
* bgpd/(general) refcount struct peer and bgp_info, hence allowing us
add work_queues for bgp_process.
* bgpd/bgp_route.h: (struct bgp_info) Add 'lock' field for refcount.
Add bgp_info_{lock,unlock} helper functions.
Add bgp_info_{add,delete} helpers, to remove need for
users managing locking/freeing of bgp_info and bgp_node's.
* bgpd/bgp_table.h: (struct bgp_node) Add a flags field, and
BGP_NODE_PROCESS_SCHEDULED to merge redundant processing of
nodes.
* bgpd/bgp_fsm.h: Make the ON/OFF/ADD/REMOVE macros lock and unlock
peer reference as appropriate.
* bgpd/bgp_damp.c: Remove its internal prototypes for
bgp_info_delete/free. Just use bgp_info_delete.
* bgpd/bgpd.h: (struct bgp_master) Add work_queue pointers.
(struct peer) Add reference count 'lock'
(peer_lock,peer_unlock) New helpers to take/release reference
on struct peer.
* bgpd/bgp_advertise.c: (general) Add peer and bgp_info refcounting
and balance how references are taken and released.
(bgp_advertise_free) release bgp_info reference, if appropriate
(bgp_adj_out_free) unlock peer
(bgp_advertise_clean) leave the adv references alone, or else
call bgp_advertise_free cant unlock them.
(bgp_adj_out_set) lock the peer on new adj's, leave the reference
alone otherwise. lock the new bgp_info reference.
(bgp_adj_in_set) lock the peer reference
(bgp_adj_in_remove) and unlock it here
(bgp_sync_delete) make hash_free on peer conditional, just in
case.
* bgpd/bgp_fsm.c: (general) document that the timers depend on
bgp_event to release a peer reference.
(bgp_fsm_change_status) moved up the file, unchanged.
(bgp_stop) Decrement peer lock as many times as cancel_event
canceled - shouldnt be needed but just in case.
stream_fifo_clean of obuf made conditional, just in case.
(bgp_event) always unlock the peer, regardless of return value
of bgp_fsm_change_status.
* bgpd/bgp_packet.c: (general) change several bgp_stop's to BGP_EVENT's.
(bgp_read) Add a mysterious extra peer_unlock for ACCEPT_PEERs
along with a comment on it.
* bgpd/bgp_route.c: (general) Add refcounting of bgp_info, cleanup
some of the resource management around bgp_info. Refcount peer.
Add workqueues for bgp_process and clear_table.
(bgp_info_new) make static
(bgp_info_free) Ditto, and unlock the peer reference.
(bgp_info_lock,bgp_info_unlock) new exported functions
(bgp_info_add) Add a bgp_info to a bgp_node in correct fashion,
taking care of reference counts.
(bgp_info_delete) do the opposite of bgp_info_add.
(bgp_process_rsclient) Converted into a work_queue work function.
(bgp_process_main) ditto.
(bgp_processq_del) process work queue item deconstructor
(bgp_process_queue_init) process work queue init
(bgp_process) call init function if required, set up queue item
and add to queue, rather than calling process functions directly.
(bgp_rib_remove) let bgp_info_delete manage bgp_info refcounts
(bgp_rib_withdraw) ditto
(bgp_update_rsclient) let bgp_info_add manage refcounts
(bgp_update_main) ditto
(bgp_clear_route_node) clear_node_queue work function, does
per-node aspects of what bgp_clear_route_table did previously
(bgp_clear_node_queue_del) clear_node_queue item delete function
(bgp_clear_node_complete) clear_node_queue completion function,
it unplugs the process queues, which have to be blocked while
clear_node_queue is being processed to prevent a race.
(bgp_clear_node_queue_init) init function for clear_node_queue
work queues
(bgp_clear_route_table) Sets up items onto a workqueue now, rather
than clearing each node directly. Plugs both process queues to
avoid potential race.
(bgp_static_withdraw_rsclient) let bgp_info_{add,delete} manage
bgp_info refcounts.
(bgp_static_update_rsclient) ditto
(bgp_static_update_main) ditto
(bgp_static_update_vpnv4) ditto, remove unneeded cast.
(bgp_static_withdraw) see bgp_static_withdraw_rsclient
(bgp_static_withdraw_vpnv4) ditto
(bgp_aggregate_{route,add,delete}) ditto
(bgp_redistribute_{add,delete,withdraw}) ditto
* bgpd/bgp_vty.c: (peer_rsclient_set_vty) lock rsclient list peer
reference
(peer_rsclient_unset_vty) ditto, but unlock same reference
* bgpd/bgpd.c: (peer_free) handle frees of info to be kept for lifetime
of struct peer.
(peer_lock,peer_unlock) peer refcount helpers
(peer_new) add initial refcounts
(peer_create,peer_create_accept) lock peer as appropriate
(peer_delete) unlock as appropriate, move out some free's to
peer_free.
(peer_group_bind,peer_group_unbind) peer refcounting as
appropriate.
(bgp_create) check CALLOC return value.
(bgp_terminate) free workqueues too.
* lib/memtypes.c: Add MTYPE_BGP_PROCESS_QUEUE and
MTYPE_BGP_CLEAR_NODE_QUEUE
|
|
* memtypes.h: update this auto-built file. (maybe we should just
remove it, is GNU awk a terrible dependency to have?)
|
|
* workqueue.h: Add a WQ_QUEUE_BLOCKED item_status return code,
to allow a queue function to indicate the queue is not
ready/blocked - rather than any problem with the item at hand.
Add a notion of being able to 'plug' and 'unplug' a queue.
Add helpers to plug/unplug a queue.
Add a completion callback, to be called when a queue is emptied.
* workqueue.c: (work_queue_new) remove useless list_free.
(work_queue_schedule) new internal helper function to schedule
queue, if appropriate.
(work_queue_add) use work_queue_schedule
(show_work_queues) Print 'P' if queue is plugged.
(work_queue_plug) new API function, plug a queue - ie prevent it
from 'drained' / processed / scheduled.
(work_queue_unplug) unplug a queue, allowing it to be drained
/ scheduled / processed again.
(work_queue_run) Add support for WQ_QUEUE_BLOCKED.
Add comment for RETRY_NOW case.
Make hysteris more aggresive in ramping up granularity, improves
performance significantly.
Add support for calling completion callback when queue is emptied,
possibly useful for knowing when to unplug a queue.
|
|
* routemap.c: (rmap_onmatch_goto) fix crash if 'continue' command
is used, which does not supply an argv[0].
this is a backport candidate /iff/ the trailing ; is removed
from VTY_GET_INTEGER_RANGE
* vty.h: fix the VTY_GET macros, do {..} while(0) so they have
correct function like syntax in usage.
|
|
* memtypes.awk: use character classes, which work correctly in
all LC_COLLATE environments, unlike A-Z, which doesnt work in
eg estonian collate order. Reported by Hasso.
|
|
* memtypes.c: (memory_list_bgp) add MTYPE_BGP_PEER_HOST
|
|
* sockunion.c: (sockunion_getsockname) use MTYPE_SOCKUNION, not TMP
(sockunion_getpeername) ditto
|
|
* thread.c: (thread_cancel_event) the number of pending events
cancelled is potentially useful information, dont throw it away,
pass it back to the caller.
|
|
* getopt.h: It's not just __GNU_LIBRARY__ which defines
getopt, eg __EXTENSIONS__ does too on SunOS. It still seems
awfully fragile though.
* getopt.c: include zebra.h after config.h, before including
getopt.h so that things at least are consistent..
* getopt1.c: ditto
|
|
* configure.ac: Check for OSes which support passing ifindex in
struct ip_mreq.
* lib/sockopt.c: Add support for BSD style ifindex in ip_mreq.
* ospfd/ospf_network.c: Log ifindex on multicast membership leave/join
events.
|
|
* (general) extern and static'ification of functions in code and
header.
Cleanup any definitions with unspecified arguments.
Add casts for callback assignments where the callback is defined,
typically, as passing void *, but the function being assigned has
some other pointer type defined as its argument, as gcc complains
about casts from void * to X* via function arguments.
Fix some old K&R style function argument definitions.
Add noreturn gcc attribute to some functions, as appropriate.
Add unused gcc attribute to some functions (eg ones meant to help
while debugging)
Add guard defines to headers which were missing them.
* command.c: (install_node) add const qualifier, still doesnt shut
up the warning though, because of the double pointer.
(cmp_node) ditto
* keychain.c: (key_str2time) Add GET_LONG_RANGE() macro, derived
fromn vty.h ones to fix some of the (long) < 0 warnings.
* thread.c: (various) use thread_empty
(cpu_record_hash_key) should cast to uintptr_t, a stdint.h type
* vty.h: Add VTY_GET_IPV4_ADDRESS and VTY_GET_IPV4_PREFIX so they
removed from ospfd/ospf_vty.h
* zebra.h: Move definition of ZEBRA_PORT to here, to remove
dependence of lib on zebra/zserv.h
|
|
|
|
* stream.h: Add comment about the special zero-ing ability of
stream_put.
(stream_recvmsg, stream_write) should return ssize_t and size_t
respectively. Should both be extern linkage.
(stream_recvfrom) Stream aware wrapper around recvfrom, in style
of stream_read_try.
* stream.c: (stream_recvfrom) new function, wrapper around recvfrom.
(stream_recvmsg, stream_write) ssize_t and size_t return values
|
|
Add wall-clock timing statistics to 'show thread cpu' output.
* thread.h: Define struct rusage_t to contain wall-clock time
and cpu time. Change GETRUSAGE macro to collect both pieces
of data. Make appropriate changes to struct cpu_thread_history
to track CPU time and real time. Change proto for
thread_consumed_time to return real and cpu time elapsed.
And declare a new global variable 'struct timeval recent_time'.
* thread.c (struct timeval recent_time): New global timestamp variable.
(timeval_adjust): If timeout is negative, set to 0 (not 10
microseconds). And remove upper bound of 1,000,000 seconds, since
this does not seem to make any sense (and it breaks
funcname_thread_add_timer_timeval).
(timeval_cmp): Should return long, not int.
(vty_out_cpu_thread_history): Show CPU time and real time.
(cpu_record_hash_print): Calculate totals for CPU and real time.
(cpu_record_print): Change 'show thread cpu' title to show CPU and
real time.
(thread_timer_remain_second): Put current time in global recent_time.
(funcname_thread_add_timer_timeval): Fix assert. Replace 2-case
switch assignment with a ternary expression. Use global recent_time
variable. Fix use of timeval_adjust (previously, the value was not
actually being adjusted).
(thread_cancel): Add missing "break" statement in case
THREAD_BACKGROUND.
(thread_timer_wait): Use global recent_time value instead of calling
gettimeofday. And there's no need to check for negative timeouts,
since timeval_subtract already sets these to zero.
(thread_timer_process): Timers are sorted, so bail out once we
encounter a timer that has not yet popped. And remove some
extraneous asserts.
(thread_fetch): Do not process foreground timers before calling
select. Instead, add them to the ready list just after the select.
Also, no need to maintain a count of the number of ready threads,
since we don't care how many there are, just whether there's
one at the head of the ready list (which is easily checked).
Stick current time in global variable recent_time to reduce
the number of calls to gettimeofday. Tighten logic for
calculating the select timeout.
(thread_consumed_time): Now returns real time and puts the elapsed
cpu time in an additional argument.
(thread_should_yield): Use real (wall-clock) time to decide whether
to yield.
(thread_call): Maintain CPU and real time statistics.
* vty.c (vty_command): For slow commands, show real and cpu time.
|
|
* workqueue.c (show_work_queues): Remove unused gettimeofday call.
|
|
* memory.h: memtypes is built source, default includes points to
top_builddir, so we should refer to lib/memtypes.h
|
|
* workqueue.h: (struct work_queue_item) change retry_count to ran,
its a count of number item has been run.
* workqueue.c: (show_work_queues) Fix formating of slightly
bugfix: fix SIGFPE if wq->runs is 0.
(work_queue_run) retry logic was slightly wrong.
cycles.best is 0 initialy, granularity is 1, so update best
if cycles >= granularity, not just >.
|
|
* buffer.c (buffer_write): Comment out call to buffer_flush_available.
This should speed up buffering at the expense of a possible increase
in latency in flushing the data if inside a long-running thread.
|
|
|
|
* thread.c: Kill unused TIMER_NO_SORT bits
|
|
* memory.c: Make the string field much wider
* memtypes.c: Correct the prefix list str/entry strings
|
|
* Makefile.am: Refer to source files via srcdir variable, fix
out-of-tree build breakage.
|
|
* thread.h: Fix type for struct thread_master add_type: should be
unsigned char. Also, add some documentation of thread_add_background
args. And remove extraneous declaration of
show_thread_work_queues_cmd.
|
|
* memory.h: Move include of memtypes.h to after the definition of
struct memory_list, gcc 4.0 doesn't like arrays of incomplete
types.
|
|
* thread.h: Add background thread type and thread_add_background
macro and accompanying funcname_... function.
export thread_should_yield, background threads can use it.
Lower thread yield time to 10ms, 100ms is noticeable lag and
a thread would only be /starting/ to finish sometime afterward.
* thread.c: (general) Add background thread type and schedule
nearly all thread types through the ready list for fairness.
(timeval_adjust) static qualifier missing
(vty_out_cpu_thread_history) add support for printout of
background threads
(show_thread_cpu) ditto.
(thread_master_debug) add debug of background list
(thread_master_create) fixup long line
(thread_add_unuse) add asserts for required state.
(thread_master_free) free background thread list
(funcname_thread_add_timer_timeval) make generic, able to
support arbitrary timer-like thread types.
(funcname_thread_add_timer) pass thread type to .._add_timer_timeval
(funcname_thread_add_timer_msec) ditto
(funcname_thread_add_background) Add a background thread, with an
optional millisecond delay factor, using .._add_timer_timeval.
(thread_cancel) Add background thread type.
Move the thread_list_delete common to all cases to bottom of
function, after the switch statement..
(thread_cancel_event) indent
(thread_timer_wait) Static qualifier, and make it able to cope
with arbitrary timer-like thread lists, so its of use to
background threads too.
(thread_process_fd) static qualifier. Again, make it take a list
reference rather than thread_master. Fix indentation.
(thread_timer_process) Check for ready timer-like threads in the
given list and move them on to the ready list - code originally
embedded in thread_fetch.
(thread_fetch) Schedule all threads, other than events, through
the ready list, to ensure fairness. Timer readying code moved to
thread_timer_process so it can be reused for background threads.
Remove the unneeded quagga_sigevent_process, as pointed out by
John Lin <john.ch.lin@gmail.com>.
(thread_should_yield) make this available.
|
|
* configure.ac: Added AC_ARG_ENABLE(time-check). By default,
warning messages will now be printed for threads or commands that take
longer than 5 seconds, but this configure argument can be used
to disable the checks or change the threshold.
* thread.h (thread_consumed_time): Declare new function to calculate
elapsed microseconds.
* thread.c (thread_consumed_time): Must be global not static so we
can call it from lib/vty.c:vty_command.
(thread_should_yield): Surround with `#if 0' to make clear that this
function is not currently being used anywhere.
(thread_call): If CONSUMED_TIME_CHECK is defined, print a CPU HOG
warning message if the thread takes more than CONSUMED_TIME_CHECK
microseconds.
* vty.c (vty_command): If CONSUMED_TIME_CHECK is defined, print a CPU
HOG warning message if the command takes more than CONSUMED_TIME_CHECK
microseconds.
|
|
* memtypes.c: the comment about use of comments in the comments
headers was causing comment within comment warnings from compiler
* memtypes.awk: Add extensive comments on the file format for
memtypes.c.
tighten the pattern for the MTYPE matching action (suggestion from
Andrew) and tighten which field we try the match on.
|
|
* Makefile.am: memtypes.awk is gawk dependent, use the GAWK automake
var.
* memtypes.h: New file, auto-generated, checked in for convenience.
|
|
* memtypes.c: The new, unified location for memory type definitions.
The memtype enum and declarations for memory_lists are built from
this automatically and put into memtypes.h.
* memtypes.awk: New script to generate memtypes.h from memtypes.c
* memory.h: Finally, the enum can banished!
* memory.c: Finally, the seperate mtype memory_list definitions can
be banished!
(log_memstats) Increase width of fields
(show_memory_zebra_cmd) display zebra specific memory types.
Increase width of fields.
* Makefile.am: Add memtypes.{c,h}, add BUILT_SOURCES for memtypes.h
Add a rule to build memtypes.h using memtypes.awk.
Add memtypes.awk to EXTRA_DIST.
|
|
Implement non-blocking zclient I/O with buffering.
* zclient.h (struct zclient): Add two fields to support non-blocking
I/O: struct buffer *wb, and struct thread *t_write.
(zclient_free): Remove function.
(zebra_redistribute_send): Change 2nd arg from socket fd to
struct zclient * (needed to support non-blocking I/O and buffering).
(zclient_send_message): New function to send an arbitrary
message with non-blocking I/O.
* zclient.c (zclient_new): Create write buffer.
(zclient_free): Remove unused function.
(zclient_stop): Must cancel new t_write thread. Also, reset
all buffers: ibuf, obuf, and wb.
(zclient_failed): New helper function for typical error handling.
(zclient_flush_data): New thread to flush queued data.
(zclient_send_message): New function to send the message in
zclient->obuf to zebra using non-blocking I/O and buffering.
(zebra_message_send, zapi_ipv4_route, zapi_ipv6_route): Use
new zclient_send_message function instead of calling writen.
(zclient_start): Set socket non-blocking. Also, change 2nd arg
to zebra_redistribute_send from zclient->sock to zclient.
(zebra_redistribute_send): Change 2nd arg to struct zclient *.
Can now use zclient->obuf to assemble the message instead of
allocating a temporary stream. And call zclient_send_message to
send the message instead of writen.
(zclient_read): Convert to support non-blocking I/O by using
stream_read_try instead of deprecated stream_read.
(zclient_redistribute): Change 2nd arg to zebra_redistribute_send
from zclient->sock to zclient.
* ospf6_zebra.c (ospf6_zebra_redistribute, ospf6_zebra_no_redistribute):
Change 2nd arg to zebra_redistribute_send from zclient->sock
to zclient.
* ospf_zebra.c (ospf_zebra_add): Call zclient_send_message instead
of writen.
* rip_zebra.c (rip_redistribute_set, rip_redistribute_unset,
rip_redistribute_clean): Change 2nd arg to zebra_redistribute_send
from zclient->sock to zclient.
* ripng_zebra.c (ripng_redistribute_unset, ripng_redistribute_clean):
Change 2nd arg to zebra_redistribute_send from zclient->sock
to zclient.
* bgp_zebra.c (bgp_redistribute_set, bgp_redistribute_unset):
The 2nd arg to zebra_redistribute_send is now zclient instead of
zclient->sock.
* isis_zebra.h (isis_zebra_finish): Remove declaration of unused
function.
* isis_zebra.c (isis_zebra_route_add_ipv4): Call zclient_send_message
to send the message to zebra instead of calling writen directly, since
zclient_send_message understands non-blocking I/O and will manage
the buffer queue appropriately.
(isis_zebra_finish): Remove unused function, particularly since
the zclient_free function has been removed.
|
|
|
|
* sigevent.c: On GNU_LINUX, check whether __USE_GNU is already defined.
|
|
* vty.c: (vty_log_fixed) Use casts to (void *) to try to eliminate
compiler warnings when assigning a (const char *) value to
struct iovec iov_base.
|
|
* zebra.h: If GNU_LINUX is defined, then define _GNU_SOURCE. This
fixes a problem where we were not getting the declaration of strnlen
in <string.h>.
|
|
Closes Bugzilla #167.
|
|
inet_ntoa alike.
* ripngd.[hc], ripng_interface.c, ripng_peer.c: inet6_ntoa() takes
argument now by value.
|
|
* (global): Fix up list loops to match changes in lib/linklist,
and some basic auditing of usage.
* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
* HACKING: Add notes about deprecating interfaces and commands.
* lib/linklist.h: Add usage comments.
Rename getdata macro to listgetdata.
Rename nextnode to listnextnode and fix its odd behaviour to be
less dangerous.
Make listgetdata macro assert node is not null, NULL list entries
should be bug condition.
ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
with for loop, Suggested by Jim Carlson of Sun.
Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
"safety" of previous macro.
LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
distinguish from the similarly named functions, and reflect their
effect better.
Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
with the old defines which were modified above,
for backwards compatibility - guarded to prevent Quagga using it..
* lib/linklist.c: fix up for linklist.h changes.
* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
scan of the area list, rather than scanning all areas first for
INTER_ROUTER and then again for INTER_NETWORK. According to
16.2, the scan should be area specific anyway, and further
ospf6d does not seem to implement 16.3 anyway.
|
|
ripngd/ripngd.c (inet6_ntop).
* ripngd.[hc]: Remove inet6_ntop() and any usage of it. inet6_ntoa()
from lib is used now.
* ripng_interface.c: inet6_ntop() -> inet6_ntoa().
* ripng_peer.c: inet6_ntop() -> inet6_ntoa().
|
|
* lib/vty.c: Improve logging of failures to open vty socket(s).
See bugid #163.
* zebra/zserv.c: print more helpful errors when we fail to successfully
bind and listen on zserv socket. Closes bugzilla #163.
|
|
* if_ioctl.c: (interface_list_ioctl) Use if_get_by_name_len.
* if_proc.c: (ifaddr_proc_ipv6) Increase size of ifname buffer to
avoid overflow.
* kernel_socket.c: (ifan_read) Use if_get_by_name_len.
* if.h: Fix comments to reflect that if_lookup_by_name and
if_get_by_name now require the argument strings to be NUL-terminated.
* if.c: (if_lookup_by_name) Compare using strcmp.
(if_get_by_name) Pass strlen(ifname) as 2nd arg to if_create.
|
|
* if.c: (if_nametoindex) The man page is rather vague, but it seems
like the argument to if_nametoindex has an implicit maximum length
of IFNAMSIZ characters.
|
|
* 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.
|
|
* str.c: Replace strlcpy and strlcat with actual working versions
copied from rsync-2.6.2/lib/compat.c.
|
|
Fix problems when netlink interfaces are renamed (same ifindex used
for a new interface). Start cleaning up some problems with the way
interface names are handled.
* interface.c: (if_new_intern_ifindex) Remove obsolete function.
(if_delete_update) After distributing the interface deletion message,
set ifp->ifindex to IFINDEX_INTERNAL.
(if_dump_vty) Detect pseudo interface by checking if ifp->ifindex is
IFINDEX_INTERNAL.
(zebra_interface) Check return code from interface_cmd.func.
Do not set internal ifindex values to if_new_intern_ifindex(),
since we now use IFINDEX_INTERNAL for all pseudo interfaces.
* kernel_socket.c: (ifm_read) Fix code and comments to reflect that
all internal interfaces now have ifp->ifindex set to IFINDEX_INTERNAL.
* rt_netlink.c: (set_ifindex) New function used to update ifp->ifindex.
Detects interface rename events by checking if that ifindex is already
being used. If it is, delete the old interface before assigning
the ifindex to the new interface.
(netlink_interface, netlink_link_change) Call set_ifindex to update
the ifindex.
* if.h: Remove define for IFINDEX_INTERNBASE and add define
IFINDEX_INTERNAL 0, since all internal (i.e. non-kernel) pseudo-
interfaces should have ifindex set to 0.
(if_new) Remove function.
(if_delete_retain) New function to delete an interface without
removing from iflist and freeing the structure.
(ifname2ifindex) New function.
* if.c: (if_new) Remove function (absorb into if_create).
(if_create) Replace function if_new with call to calloc.
Set ifp->ifindex to IFINDEX_INTERNAL. Fix off-by-one error
in assert to check length of interface name. Add error message
if interface with this name already exists.
(if_delete_retain) New function to delete an interface without
removing from iflist and freeing the structure.
(if_delete) Implement with help of if_delete_retain.
(ifindex2ifname) Reimplement using if_lookup_by_index.
(ifname2ifindex) New function to complement ifindex2ifname.
(interface) The interface command should check the name length
and fail with a warning message if it is too long.
(no_interface) Fix spelling in warning message.
(if_nametoindex) Reimplement using if_lookup_by_name.
(if_indextoname, ifaddr_ipv4_lookup) Reimplement using
if_lookup_by_index.
* bgp_zebra.c: (bgp_interface_delete) After deleting, set ifp->ifindex
to IFINDEX_INTERNAL.
* isis_zebra.c: (isis_zebra_if_del) Call if_delete_retain instead
of if_delete, since it is generally not safe to remove interface
structures. After deleting, set ifp->ifindex to IFINDEX_INTERNAL.
(zebra_interface_if_lookup) Tighten up code.
* ospf6_zebra.c: (ospf6_zebra_if_del) Previously, this whole function
was commented out. But this is not safe: we should at least update
the ifindex when the interface is deleted. So the new version
updates the interface status and sets ifp->ifindex to
IFINDEX_INTERNAL.
(ospf6_zebra_route_update) Use if_indextoname properly.
* ospf_vty.c: (show_ip_ospf_interface_sub) Show ifindex and interface
flags to help with debugging.
* ospf_zebra.c: (ospf_interface_delete) After deleting, set ifp->ifindex
to IFINDEX_INTERNAL.
(zebra_interface_if_lookup) Make function static. Tighten up code.
* rip_interface.c: (rip_interface_delete) After deleting, set
ifp->ifindex to IFINDEX_INTERNAL.
* ripng_interface.c: (ripng_interface_delete) After deleting, set
ifp->ifindex to IFINDEX_INTERNAL.
|
|
* configure.ac: Add strnlen to AC_CHECK_FUNCS.
* zebra.h: Should include str.h to pick up missing functions.
* str.h: Declare strnlen if needed.
* str.c: Do not include str.h since zebra.h now includes it.
(strnlen) New function.
|