Age | Commit message (Collapse) | Author |
|
Quagga makes bad assumptions about sockaddr_dl (on NetBSD, but possibly
on other systems as well). Particularly, sizeof(struct sockaddr_dl)
returns a size that does not include the full sdl_data field, leading to
not enough data being copied. This breaks IPv6 RAs in particular, as
a broken mac address from sockaddr_dl will be included in the packets.
From: Matthias-Christian Ott <ott@mirix.org>
Tested-by: Uwe Toenjes <6bone@6bone.informatik.uni-leipzig.de>
[further simplified + more comments]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
ifi_link_state missing in OS X. There could be other *BSD's that haven't
implemented it and possibly affects older implementations.
The existing HAVE_BSD_LINK_DETECT configure.ac check is only confirming
the link state detection using ifmediareq.ifm_status found in
<net/if_media.h>. This is the link state detection used in
zebra/ioctl.c. Later, *BSD redefined struct if_data in <net/if.h> and
included link state detection. This is the method used in
zebra/kernel_socket.c
Additional test defined in config.ac to test for member struct
if_data.ifi_link_state defined in <net/if.h> separate from test for
<net/if_media.h> ifmediareq.ifm_status
Fixed #ifdef's in zebra/kernel_socket.c to use the new #define
No impact on older function calls in zebra/ioctl.c
Tested on 64bit OS X 10.7, FreeBSD 9.0 amd64 & i386 (32bit)
using gcc & clang. Tested on linux 64bit.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
In zebra/kernel_socket.c, copying sockaddr from *_msghdr:
There are really 2 different lengths that need to be determined.
1) the length required to point to the next sockaddr in the mesg
buffer which might include any required padding and
2) the actual length of the sockaddr data that needs to be copied
into the destination field.
They may or may not be the same value.
Sizeof sockaddr_in6 is 28, which to pad for alignment purposes on 32
bit systems with a long of 4 bytes is evenly divided and requires
no padding. On 64 bit systems, with a long of 8 it is padded with 4
extra bytes.So the current RTA_* macros are copying 32 bytes into a 28
byte field on 64 bitsystems, where the field overflow did not occur
on the 32 bit systems.
Since using sa_len required the use of an #ifdef which couldn't be used
directly inside a #define, it made sense to move the copy into the
function to allow typdef checking throughout and eliminate the hack
to suppress compiler warnings.
Fixed declaration of cp in ifm_read after compiler noticed type mismatch.
Tested on 64bit OS X 10.7, FreeBSD 9.0 amd64 & i386 (32bit)
using gcc & clang
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
In OS X 10.7 zebra crashed on invalid execution address.
sockaddr padding in *_msghdr is observed to be 4 bytes in 64bit OS X.
The ROUNDUP macro assumed alignment on sizeof(long) which
allocates 8 bytes on 64bit systems, 4 bytes on 32bit systems
which is true for BSD generally.
Test for Apple and use sizeof(int) which allocates 4 bytes on 32 & 64bit
systems.
Tested on 64bit OS X 10.7, FreeBSD 9.0 amd64 & i386 (32bit)
using gcc & clang
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
|
|
|
|
This patch contains the following:
1. Addition of IPv4 SAFI_MULTICAST BGP routes into the RTM's RIB.
2. Deletion of IPv4 SAFI_MULTICAST BGP routes from the RTM's RIB.
|
|
* kernel_socket.c: (ifm_read) The reorganization from commit
6fe70d1b35c189cb1e488b2c26551ba7baac6148 removed setting the
interface link-layer socket address structure on routing socket
platforms. This restores saving the link-layer information because
it might be used elsewhere: rtm_write() when no gateway is given,
if_dump_vty() and rtadv_send_packet().
|
|
|
|
The RTF_CLONING flag has been removed in FreeBSD 8.0 with arp-v2 (see
http://svn.freebsd.org/viewvc/base/stable/8/UPDATING?view=markup),
since it no longer has any meaning. This patch checks if RTF_CLONING
exists before using it.
|
|
* kernel_socket.c: (rtm_flag_dump) Use a const message pointer to be
in sync with commit ce0db9cb11c0bc2e7f89a7d042e50afa495556b4.
|
|
|
|
2008-08-14 Stephen Hemminger <stephen.hemminger@vyatta.com>
* lib/log.{c,h}: struct message argument should point to const
* */*.c: adjust to suit,
Signed-off-by: Paul Jakma <paul@quagga.net>
|
|
2008-01-11 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* lib/zebra.h: Revert previous change, no need to include
<net/if_media.h> here.
* zebra/ioctl.c: If HAVE_BSD_LINK_DETECT is defined, include
<net/if_media.h>
(if_get_flags) Remove debug messages about BSD link state.
* zebra/kernel_socket.c: (bsd_linkdetect_translate) If link state
is unknown, we should set the IFF_RUNNING flag.
|
|
2008-01-10 Ingo Flaschberger <if@xip.at>
* configure.ac: Define HAVE_BSD_LINK_DETECT if <net/if_media.h> is
present.
* lib/zebra.h: If HAVE_BSD_LINK_DETECT is defined,
include <net/if_media.h>.
* zebra/ioctl.c: (if_get_flags) If HAVE_BSD_LINK_DETECT, use the
SIOCGIFMEDIA ioctl to ascertain link state.
* zebra/kernel_socket.c: (bsd_linkdetect_translate) New function to
map the ifm_data.ifi_link_state value into the IFF_RUNNING flag.
(ifm_read) Call bsd_linkdetect_translate to fix the IFF_RUNNING
flag before calling if_flags_update.
|
|
the RIB debug changeset).
after
|
|
|
|
|
|
|
|
|
|
|
|
2007-05-17 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* kernel_socket.c: (ifam_read_mesg) Grab RTA_DST and RTA_GATEWAY
addresses from the message (if present, which seems unlikely on
current BSD platforms), and show them in the debug messages.
Also, add ifam_flags to the debug messages.
(ifam_read) If the interface is point-to-point, then the RTA_BRD
address should be treated as a peer address.
|
|
2007-05-09 Paul Jakma <paul.jakma@sun.com>
* configure.ac: sys/conf.h depends on sys/param.h, at least on
FBSD 6.2.
(bug #363) Should check for in_pktinfo for IRDP
2006-05-27 Paul Jakma <paul.jakma@sun.com>
* configure.ac: General cleanup of header and type checks, introducing
an internal define, QUAGGA_INCLUDES, to build up a list of
stuff to include so as to avoid 'present but cant be compiled'
warnings.
Misc additional checks of things missing according to autoscan.
Add LIBM, for bgpd's use of libm, so as to avoid burdening
LIBS, and all the binaries, with libm linkage.
Remove the bad practice of using m4 changequote(), just
quote the []'s in the case statements properly.
This should fix bugs 162, 303 and 178.
* */*.{c,h}: Update all HAVE_* to the standard autoconf namespaced
HAVE_* defines. I.e. HAVE_SA_LEN -> HAVE_STRUCT_SOCKADDR_SA_LEN,
* bgpd/Makefile.am: Add LIBM to bgpd's LDADD, for pow().
|
|
2007-05-01 David L Stevens <dlstevens@us.ibm.com>
* (general) These changes collectively add route-map and
prefix-list support to zebra and fix a bug in "show
route-map" (with no argument).
* doc/main.texi: added route-map, prefix-list, ip protocol
and set src documentation
* lib/command.h: added PROTOCOL_NODE type
* lib/log.c: (proto_name2num) new function, protocol name to
number translation.
* lib/routemap.c: (vty_show_route_map) fixed "show route-map"
without route-map name
* lib/routemap.h: added RMAP_ZEBRA type
* lib/zebra.h: added proto_name2num() prototype
* vtysh/extract.pl.in: added VTYSH_ZEBRA flag for route-map and
plist
* vtysh/Makefile.am: added zebra_routemap.c
* vtysh/vtysh.h: added VTYSH_ZEBRA flag to VTYSH_RMAP
* zebra/connected.c: (connected_up_ipv4) added src preference argument
to rib_add_ipv4()
* zebra/kernel_socket.c: (rtm_read) ditto
* zebra/main.c: added prefix list initialization
* zebra/Makefile.am: added zebra_routemap.c source file
* zebra/rib.h: added generic address union "g_addr" and use in
existing places that had an explicit union.
Added "src" to struct nexthop.
Added preferred src arg to nexthop_ipv4_add and rib_add_ipv4.
* zebra/rt_netlink.c: (netlink_routing_table) set preferred source on
netlink messages.
(netlink_route_change) ditto
(netlink_route_multipath) ditto.
* zebra/rtread_getmsg.c: (handle_route_entry) added (NULL) src to
rib_add_ipv4() call.
* zebra/rtread_proc.c: (proc_route_read) ditto
* zebra/zebra_rib.c: (nexthop_ipv4_add) add src argument.
(nexthop_ipv4_ifindex_add) ditto
(rib_add_ipv4) ditto
(nexthop_active_check) Add route-map processing.
* zebra/zebra_routemap.c: new file for zebra route-map commands.
* zebra/zebra_vty.c: (ip_protocol_cmd) Apply route-map to protocol
(vty_show_ip_route_detail) added "src" printing
(vty_show_ip_route) ditto
(show_ip_protocol_cmd) new command, list routemaps.
(config_write_protocol) write out routemap protocl config.
(zebra_vty_init) Install the new routemap protocol commands.
* zebra/zserv.c: (zread_ipv4_add) added (NULL) src arg
(zebra_init) init zebra route-maps.
* zebra/zserv.h: add zebra_route_map_init
|
|
2007-03-06 Paul Jakma <paul.jakma@sun.com>
* kernel_socket.c: (ifam_read) Do not update interface metric on
receipt of NEW/DEL ADDR messages, bogus as: a) some systems
dont include iface metric for address events b) we didn't
update clients either. Initial diagnosis by Eugene Grosbein.
|
|
2006-12-12 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* if.h: (struct connected) Add new ZEBRA_IFA_PEER flag indicating
whether a peer address has been configured. Comment now shows
the new interpretation of the destination addr: if ZEBRA_IFA_PEER
is set, then it must contain the destination address, otherwise
it may contain the broadcast address or be NULL.
(CONNECTED_DEST_HOST,CONNECTED_POINTOPOINT_HOST) Remove obsolete
macros that were specific to IPv4 and not fully general.
(CONNECTED_PEER) New macro to check ZEBRA_IFA_PEER flag.
(CONNECTED_PREFIX) New macro giving the prefix to insert into
the RIB: if CONNECTED_PEER, then use the destination (peer) address,
else use the address field.
(CONNECTED_ID) New macro to come up with an identifying address
for the struct connected.
* if.c: (if_lookup_address, connected_lookup_address) Streamline
logic with new CONNECTED_PREFIX macro.
* prefix.h: (PREFIX_COPY_IPV4, PREFIX_COPY_IPV6) New macros
for better performance than the general prefix_copy function.
* zclient.c: (zebra_interface_address_read) For non-null destination
addresses, set prefixlen to equal the address prefixlen. This
is needed to get the new CONNECTED_PREFIX macro to work properly.
* connected.c: (connected_up_ipv4, connected_down_ipv4,
connected_up_ipv6, connected_down_ipv6) Simplify logic using the
new CONNECTED_PREFIX macro.
(connected_add_ipv4) Set prefixlen in destination addresses (required
by the CONNECTED_PREFIX macro). Use CONNECTED_PEER macro instead
of testing for IFF_POINTOPOINT. Delete invalid warning message.
Warn about cases where the ZEBRA_IFA_PEER is set but no
destination address has been supplied (and turn off the flag).
(connected_add_ipv6) Add new flags argument so callers may set
the ZEBRA_IFA_PEER flag. If peer/broadcast address satisfies
IN6_IS_ADDR_UNSPECIFIED, then reject it with a warning.
Set prefixlen in destination address so CONNECTED_PREFIX will work.
* connected.h: (connected_add_ipv6) Add new flags argument so
callers may set the ZEBRA_IFA_PEER flag.
* interface.c: (connected_dump_vty) Use CONNECTED_PEER macro
to decide whether the destination address is a peer or broadcast
address (instead of checking IFF_BROADCAST and IFF_POINTOPOINT).
* if_ioctl.c: (if_getaddrs) Instead of setting a peer address
only when the IFF_POINTOPOINT is set, we now accept a peer
address whenever it is available and not the same as the local
address. Otherwise (no peer address assigned), we check
for a broadcast address (regardless of the IFF_BROADCAST flag).
And must now pass a flags value of ZEBRA_IFA_PEER to
connected_add_ipv4 when a peer address is assigned.
The same new logic is used with the IPv6 code as well (and we
pass the new flags argument to connected_add_ipv6).
(if_get_addr) Do not bother to check IFF_POINTOPOINT: just
issue the SIOCGIFDSTADDR ioctl and see if we get back
a peer address not matching the local address (and set
the ZEBRA_IFA_PEER in that case). If there's no peer address,
try to grab SIOCGIFBRDADDR regardless of whether IFF_BROADCAST is set.
* if_ioctl_solaris.c: (if_get_addr) Just try the SIOCGLIFDSTADDR ioctl
without bothering to check the IFF_POINTOPOINT flag. And if
no peer address was found, just try the SIOCGLIFBRDADDR ioctl
without checking the IFF_BROADCAST flag. Call connected_add_ipv4
and connected_add_ipv6 with appropriate flags.
* if_proc.c: (ifaddr_proc_ipv6) Must pass new flags argument to
connected_add_ipv6.
* kernel_socket.c: (ifam_read) Must pass new flags argument to
connected_add_ipv6.
* rt_netlink.c: (netlink_interface_addr) Copy logic from iproute2
to determine local and possible peer address (so there's no longer
a test for IFF_POINTOPOINT). Set ZEBRA_IFA_PEER flag appropriately.
Pass new flags argument to connected_add_ipv6.
(netlink_address) Test !CONNECTED_PEER instead of if_is_broadcast
to determine whether the connected destination address is a
broadcast address.
* bgp_nexthop.c: (bgp_connected_add, bgp_connected_delete)
Simplify logic by using new CONNECTED_PREFIX macro.
* ospf_interface.c: (ospf_if_is_configured, ospf_if_lookup_by_prefix,
ospf_if_lookup_recv_if) Simplify logic using new CONNECTED_PREFIX
macro.
* ospf_lsa.c: (lsa_link_ptop_set) Using the new CONNECTED_PREFIX
macro, both options collapse into the same code.
* ospf_snmp.c: (ospf_snmp_if_update) Simplify logic using new
CONNECTED_ID macro.
(ospf_snmp_is_if_have_addr) Simplify logic using new CONNECTED_PREFIX
macro.
* ospf_vty.c: (show_ip_ospf_interface_sub) Use new CONNECTED_PEER macro
instead of testing the IFF_POINTOPOINT flag.
* ospfd.c: (ospf_network_match_iface) Use new CONNECTED_PEER macro
instead of testing with if_is_pointopoint. And add commented-out
code to implement alternative (in my opinion) more elegant behavior
that has no special-case treatment for PtP addresses.
(ospf_network_run) Use new CONNECTED_ID macro to simplify logic.
* rip_interface.c: (rip_interface_multicast_set) Use new CONNECTED_ID
macro to simplify logic.
(rip_request_interface_send) Fix minor bug: ipv4_broadcast_addr does
not give a useful result if prefixlen is 32 (we require a peer
address in such cases).
* ripd.c: (rip_update_interface) Fix same bug as above.
|
|
* kernel_socket.c (rtm_type_str): ifdef RTM_OLD{ADD,DEL} to
compile on systems that no longer define them.
|
|
2006-05-17 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* kernel_socket.c: (ifam_read_mesg) Improve debug message
to show the IP address.
|
|
2006-01-25 Paul Jakma <paul.jakma@sun.com>
* (general) More solaris PF_ROUTE hacks. The IFF_UP mangling
for solaris was incomplete on the PF_ROUTE side. fix it.
This changeset generally uglifies things. For some future
work I'd like to see the state changes seperated out from
the details of the code. Differences between systems might
then be slightly easier to implement without convoluted
hacks.
Changes should be specific to Solaris mostly, however
also tested on FreeBSD 6.
* if_ioctl_solaris.c: (interface_list_ioctl) ignore ~IFF_UP
interfaces, we'll hear about them when/if interface goes up
through NEWADDR.
Update flags explicitely at end of it to kick mangling.
* ioctl_solaris.c: (if_mangle_up) removed to interface.c, in
kind.
(lifreq_set_name) more convenient to take the string, than
the ifp.
(if_get_flags_direct) new convenience function, returns
the actual flags. Used during bootstrap in if_ioctl_solaris.c
to peek at flags of logical interfaces to see whether or
not to ignore them.
(if_get_flags) ENXIO means it's gone, poke out IFF_UP and
kick flags update.
(if_{un,}set_flags) flags argument should be 64bit.
* ioctl.{c,h}: flags argument should be 64bit.
* interface.h: Add a 'primary_state' flag to struct zebra_if on
SUNOS_5.
Export if_flags_update.
* interface.c: (if_flags_mangle) moved over in kind from
ioctl_solaris.c. Nasty kludge to try get IFF_UP right, as
much as is possible. Also keep track of the actual IFF_UP
value for the primary interface, so we can know when the ifp
must be deleted.
(if_flags_update) Take a new interface flags value, apply it
to the interface, and take whatever actions are required due
to flag transitions.
(if_refresh) flag state change logic is moved out to
previous. Just call if_get_flags, which will end up using
previous to effect the update of flags.
(if_flag_dump_vty) IFF_IPV{4,6} aren't interesting, VIRTUAL
and NOXMIT are though.
* kernel_socket.c: (ifm_read) Down->Down transitions shouldn't
create ifp, for non-IFANNOUNCE systems.
Use if_flags_update to update flags.
flag transition logic is now handled automatically through
if_flags_update.
(ifam_read) Better to call if_refresh *after* adding
connected addresses, as connected count affects IFF_UP on
IFF_UP-mangled systems.
On Solaris, Up->Down due to DELADDR means we need to delete
the ifp - the IFINFO might already have been and gone.
* rt.h: include other dependent headers.
|
|
2006-01-17 Paul Jakma <paul.jakma@sun.com>
* kernel_socket.c: (ifam_read) Read metric from RTM_NEWADDR.
If interface is an alias, pass the alias as a label for
connected_add_ipv{4,6}.
* rt_netlink.c: (netlink_interface_addr) print out
IFA_CACHEINFO info, if present, when debugging kernel
messages.
|
|
|
|
2005-11-24 Paul Jakma <paul.jakma@sun.com>
* kernel_socket.h: New header for functions exported to sysctl
methods.
* kernel_socket.c: include previous.
Remove static qualifier from couple of functions which are
used by sysctl methods, incorrectly added in previous commit.
Add a workaround for a bogus gcc warning to the RTA_ macros.
* Makefile.am: Add kernel_socket.h to noinst_HEADERS
* if_sysctl.c: include rt.h and kernel_socket.h and remove
redundant prototypes.
* rtread_sysctl.c: ditto.
(route_read) fix mismatch of return values.
* {rt,zserv,rib}.h: Include lib headers depended on.
|
|
2005-11-23 Paul Jakma <paul.jakma@sun.com>
* (general) fix some small compile errors, and mark several
functions as static.
* kernel_socket.c: (ifan_read) should be static.
fix missing brackets.
(ifm_read,ifam_read,rtm_read_mesg,kernel_read) Make static
(ifam_read_mesg) make static. fix incorrect variable name.
(rtm_read) make static. Fix call to rib_delete_ipv4 which
should be rib_delete_ipv6.
(routing_socket,kernel_init) should be static. Void argument
should be specified as such, not left incomplete.
* rt_netlink.c: rt.h should be included, contains prototypes of
exported functions.
(kernel_delete_ipv6_old) fix sign of index argument.
* rt_socket.c: Exact same as previous. Also, make various
functions static.
* rtread_getmsg.c: Include zserv.h, which prototypes
route_read. Make static.
* rtread_sysctl.c: zserv.h and rt.h should be included.
fix definition of route_read.
|
|
2005-11-12 Alexander Gall <gall@switch.ch>
* See [quagga-dev 1815]
* kernel_socket.c: (rtm_write) Use SAROUNDUP when HAVE_SIN_LEN
is not available.
* rt_socket.c: (kernel_rtm_ipv6(_multipath)) set family to
AF_INET6 on ipv6 routes.
2005-11-12 Paul Jakma <paul.jakma@sun.com>
* kernel_socket.c: Add RTA_NAME_GET macro to extract name from
sockaddr_dl. Add some more RTF_ flags.
* (ifan_read) Add some debug messages.
* (ifm_read) Add more debug messages. More robust cross-checks
of index against name.
Fall back to by-name lookup if the index lookup fails, future
proofing more than anything else.
(ifam_read_mesg) Read RTA_IFP. Add debug messages.
(ifam_read) More debug. If there's an RTA_IFP and it isn't
the name of the interface, save it as the label.
(rtm_read_mesg) Read RTA_IFP.
(rtm_read) allow name to be retrieved.
(rtmsg_debug) expand on the debug message.
|
|
2005-11-11 Paul Jakma <paul.jakma@sun.com>
* kernel_socket.c: (ifm_read) arithmetic on void pointer
warning.
(ifam_read) Fix error from connected-with-label merge,
something crept in from the pending Solaris kernel_socket.c
patch which shouldn't have.
|
|
* connected.{c,h}: Include memory.h
(connected_add_ipv4) Use MTYPE for ifc label.
(connected_add_ipv6) Also should accept label. Store it in ifp.
(connected_del_ipv4) Taking label as argument is pointless.
* rt_netlink.c: (netlink_interface_addr) update label usage
for connected_{add,delete} functions.
* if_ioctl.c: (if_getaddrs) NULL label for connected_add_ipv6.
* if_ioctl_solaris.c: (interface_list_ioctl) Pass LIFC_NOXMIT
so we also find out about NOXMIT interfaces like VNI.
Bit of hackery to turn interface names into the primary
interface name, later with routing socket messages we only
will about primary interfaces anyway, so we must normalise
the name.
(if_get_addr) take label as argument, so it can
be passed to connected_add.
If label is provided, then it is interface name to issue the
ioctl for address information on, not the ifp name.
(interface_list) List AF_UNSPEC too, just in case.
* if_proc.c: (ifaddr_proc_ipv6) label for connected_add_ipv6.
* interface.c: (if_addr_wakeup) Some very bogus code - sets
IFF_RUNNING - add comment.
(if_refresh)
(ip_address_install) Use MTYPE for ifc label.
* ioctl_solaris.c: (if_mangle_up) New function. Hackery to make
IFF_UP reflect whether any addresses are left on the
interface, as we get signalled for IFF_UP flags change on the
primary interface only. Logical interfaces dont generate
IFINFO, but we do get an RTM_DELADDR.
(if_get_flags) Call if_mangle_up before return.
* kernel_socket.c: (ifam_read) Fixup calls to
connected_{add,delete} to match above changes. Rename gate
variable to brd, less confusing.
Pass the interface name as a label, if it is not same name
as ifp->name.
|
|
* (general) RTM_CHANGE and implicit withdraw on RTM_NEWADDR
support.
* connected.c: (connected_withdraw) new function. withdraw a
connected subnet address set from zebra, and pass information
along to clients.
(connected_announce) similar, but to announce a new connected
subnet address set.
(connected_check_ipv4) renamed to connected_check, as its
AFI independent.
(connected_add_ipv{4,6}) Remove the connected address announce
stuff, use connected_announce instead.
If connected_check indicates address is already present,
treat it as an implicit withdraw of the existing address, ie
remove the old address details and replace with the new
details.
(connected_delete_ipv{4,6}) Use connected_withdraw.
(connected_check_ipv6) deleted in favour of connected_check.
* connected.h: Rename connected_check_ipv4 to connected_check.
delete connected_check_ipv6.
* interface.c: Use connected_check rather than the AFI specific
symbols.
* kernel_socket.c: (rtm_read) RTM_CHANGE support. Create a
rib delete event for the existing route, before adding route
again.
(kernel_read) we can handle RTM_CHANGE now.
|
|
rib_add_ipv6() function so that IPv6 routes in RIB can have correct
metric. No IPv6 routing daemon uses distance yet though.
* zserv.c, connected.c, kernel_socket.c, rt_netlink.c,
rtread_proc.c,zserv.c: Pass metric and distance info to the
rib_add_ipv6().
Forwardport from stable branch.
|
|
* interface.c: (if_delete_update) should always be available, not
just on RTM_IFANNOUNCE/NETLINK systems.
* kernel_socket.c: (ifan_read) only call if_delete_update when
interface departs, dont if_delete, because we wish to retain
interface configuration state even when interfaces are removed.
(ifm_read) If we dont have RTM_IFANNOUNCE, then transitioning
to down state is only chance we have to clean up interface in case
it is deleted (eg Solaris down -> unplumb -> plumb up).
* redistribute.c: (zebra_interface_delete_update) should always be
available, we /will/ call it now on all systems, via
if_delete_update.
* zserv.c: (zsend_interface_delete) ditto
(zsend_interface_address) Update the call-flow diagramme, to
reflect that if_delete_update /is/ now called on all systems,
potentially.
* zserv.h: (zsend_interface_delete) unconditionally exported, as
above.
|
|
* kernel_socket.c: (RTA_{ADDR,ATTR}_GET) fix mistake, NULL check
should be on DEST argument
|
|
* kernel_socket.c: consolidate the IFAM{ADDR,MASK}GET and
RTM{ADDR,MASK}GET macros into generic rta_addrs macros,
RTA_{ADDR,ATTR}_GET.
(af_check) could use 'inline' attribute
(ifam_read_mesg) remove IFAM{ADDR,MASK}GET macro, change to
generic macro.
(rtm_read_mesg) similar
|
|
* 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.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.
|
|
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.
|
|
* zserv.c: (zebra_accept) Comment out setting of socket to NONBLOCK
for now, as we dont actually deal with with resending.... See
bugzilla #122, fix from wawa@yandex-team.ru (Vladimir Ivanov).
* kernel_socket.c: (routing_socket) ditto.
|
|
Note two warnings in comments. The serious one is that struct
interface->ifindex probably needs to be signed, ssince we store and
compare to -1.
|
|
* *.c: Change level of debug messages to LOG_DEBUG.
|
|
* global: Replace strerror with safe_strerror. And vtysh/vtysh.c
needs to include "log.h" to pick up the declaration.
|
|
* kernel_socket.c (rtm_flag_dump): terminate buffer with '\0', not '0'.
This is arguably not a security problem, since strlcat is used to copy
to the buffer -gdt.
|
|
* ioctl.h: Add if_ioctl_ipv6 prototype and AF_IOCTL for SOLARIS_IPV6
* kernel_socket.c: Fix SAROUNDUP, compiler doesnt like do..while
RHS in assignments :)
* redistribute.c: (zebra_interface_delete_update) only used
if RTM_IFANNOUNCE and NETLINK is available.
|
|
* kernel_socket.c (kernel_read): Use sockaddr_storage in buffer
for reading kernel messages to ensure enough space (necessary on
Solaris due to sockaddr_dl being large). Thanks to Sowmini
Varadhan for help with this change.
|