summaryrefslogtreecommitdiff
path: root/usr.sbin/eigrpd
AgeCommit message (Collapse)Author
2017-07-24Unify ROUNDUP macros for parsing route messages.friehm
Use the macro from route(8) / ospf6d(8) since it works also with argument 0. OK claudio@
2017-03-21From a syslog perspective it does not make sense to log fatal andAlexander Bluhm
warn with the same severity. Switch log_warn() to LOG_ERR and keep fatal() at LOG_CRIT. OK reyk@ florian@
2017-02-22No need to use SIOCGIFRDOMAIN anymore.Renato Westphal
2017-01-08Replace hand-rolled for(;;) traversal of ctl_conns TAILQ withKenneth R Westerback
TAILQ_FOREACH(). No intentional functional change. ok reyk@
2017-01-05Replace hand-rolled for(;;) emptying of 'symhead' TAILQ with moreKenneth R Westerback
modern TAILQ_FOREACH_SAFE(). No intentional functional change. ok millert@ bluhm@ gilles@
2017-01-05Replace symset()'s hand-rolled for(;;) traversal of 'symhead' TAILQKenneth R Westerback
with more modern TAILQ_FOREACH(). This what symget() was already doing. Add paranoia '{}' around body of symget()'s TAILQ_FOREACH(). No intentional functional change. ok bluhm@ otto@
2016-10-10calls to uname(3) should be checked against non-negative valueGleydson Soares
upon successful and -1 on failure (as per POSIX). No functional change, just improves portability. requested by guenther@ looks correct to schwarze@ OK renato@
2016-09-02work on making log.c similar in all daemons:Sebastian Benoit
move daemon-local functions into new logmsg.c, and reduce the (mostly whitespace) differences so that log.c's can be diffed easily. ok claudio@
2016-09-02Minor tweaksRenato Westphal
2016-09-02Make functions and variables static whenever possible.Renato Westphal
style(9) says: "Function prototypes for private functions (i.e., functions not used elsewhere) go at the top of the first source module. In userland, functions local to one source module should be declared 'static'". The benefits of doing so include: * clean up of the eigrpd global namespace; * improved readability; * more hints to the compiler/linker to generate more efficient code. Additional changes: * Declare all extern variables in header files; * Clean up the indentation of all function prototypes and global variables. ok claudio@ benno@
2016-09-02Use static local variables instead of global variables whenever possible.Renato Westphal
Also, there's no need to zero initialize global and static variables, that's done automatically by the compiler. ok claudio@ benno@
2016-09-02Merge the recv_packet_v[46] functions into one.Renato Westphal
This reduces some code duplication and makes it easier to see the difference between the IPv4 and IPv6 raw sockets API. tweak + ok claudio@, ok benno@
2016-09-02Simplify handling of multicast addresses.Renato Westphal
During the initialization of the eigrpe process, use inet_pton() to store the EIGRP multicast addresses in two global variables: * global.mcast_addr_v4 (in_addr); * global.mcast_addr_v6 (in6_addr). This way we don't need to create temporary in_addr/in6_addr variables everytime we need to use these multicast addresses for something. "I like this" claudio@ ok benno@
2016-09-02Pledge earlier on eigrpe.Renato Westphal
This is for consistency with the other routing daemons. ok claudio@ "earlier is better" benno@
2016-09-02Remove superfluous includes and follow style(9).Renato Westphal
ok claudio@ benno@
2016-09-02Fix broken pipe teardown.Renato Westphal
* Add missing close() calls to actually close the pipes, calling just msgbuf_clean() is not enough; * Bring back some NOTREACHED lint comments. style(9) says they can be removed but in some cases they are useful to humans too; * Add __dead to the shutdown functions; * Some other minor changes to make eigrpd(8) more similar to the other routing daemons.
2016-08-08Simplify shutdown processRenato Westphal
On shutdown, there's no need to use kill(2) to kill the child processes. Just closing the IPC sockets will make the children receive an EOF, break out from the event loop and then exit. This "pipe teardown" removes a PID reuse race condition, makes the code simpler and allow us to remove "proc" from pledge. OK and tweaks from claudio@
2016-08-08rde and eigrpe should use exit(3) instead of _exit(2)Renato Westphal
Since recently these processes call exec() after fork(), so they should stop using _exit(2) and use exit(3) instead when shutting down. ok claudio@
2016-07-18add format attributes to log functions and fix two errorsSebastian Benoit
ok renato@
2016-06-21do not allow whitespace in macro names, i.e. "this is" = "a variable".Sebastian Benoit
change this in all config parsers in our tree that support macros. problem reported by sven falempin. feedback from henning@, stsp@, deraadt@ ok florian@ mikeb@
2016-06-05Fix potential SIGBUS in startup.Renato Westphal
The fork+exec diff introduced this problem where we were indirectly calling imsg_event_add() before initializing (event_set) iev_rde and iev_eigrpe. Fix this by moving down both main_imsg_send_ipc_sockets() and main_imsg_send_config(), after iev_rde and iev_eigrpe are initialized. benno@ reported this problem for the initial ospfd fork+exec attempt, now fix eigrpd too. ok deraadt
2016-06-05Call if_update() only when necessary for IPv6 address changes.Renato Westphal
For EIGRPv6, an interface only needs an link-local address in order to be enabled in the routing daemon. So adding or removing global unicast addresses, for example, will never trigger a state change in the interface. Additionally, move all address handling code to if_addr_new() and if_addr_del() to improve readability.
2016-06-05Reset the interface uptime when it is restarted.Renato Westphal
The uptime was being set only when the interface was created, which is not what we want.
2016-06-05Improve security by calling exec after fork.Renato Westphal
For each child process (rde and eigrpe), re-exec eigrpd with a special "per-role" getopt flag. This way we have seperate ASLR/cookies per process. Based on a similar patch for bgpd, from claudio@ ok deraadt
2016-05-12Disable EIGRPv6 on an interface when it loses its link-local address.Renato Westphal
2016-05-12Improve support for config reloading.Renato Westphal
2016-04-18Revert previous commit.Renato Westphal
When a process receives an EOF on a socketpair, it removes the event handler for that fd and then calls event_loopexit(). Once the process leaves the main loop, it calls its shutdown function. With that said, revert the previous patch because it was unnecessary. Pointed out and ok by deraadt@
2016-04-15Check for subnet overlap between the configured summary-addresses.Renato Westphal
2016-04-15Kill the child processes if their parent dies unexpectedly.Renato Westphal
There's no point on keeping eigrpd running if any of its processes dies unexpectedly.
2016-04-15Fix segfault on reloading the config multiple times.Renato Westphal
2016-04-15Properly implement the clear_config() function.Renato Westphal
We need to free the internal pointers of the eigrpd_conf struct, not only the main struct. This avoids memory leaks when a config reload happens to fail (e.g. due to a syntax error).
2016-04-15Move several other variables out of eigrpd_conf.Renato Westphal
Now eigrpd_conf contains only variables that can be modified via a config reload. The other variables were moved to a new struct called eigrpd_global, which is now a central point for storing global variables.
2016-04-15Move the command line options out of struct eigrpd_configRenato Westphal
into an own flag field since these can't be modified via a config reload. Pulled from bgpd. Original author: claudio@
2016-04-15Fix corner case in Feasible Condition check.Renato Westphal
From the EIGRP draft: "The Feasibility Condition is met when a neighbor's advertised cost, (RD) to a destination is less than the Feasible Distance for that destination". So, according to the draf, when the Reported Distance is EQUAL to the Feasible Distance, the Feasible Condition is NOT met.
2016-04-15Minor fixes and code cleanup.Renato Westphal
* whitespace cleanup; * copy in_addr structs directly; * add more malloc return value checks; * fix some log messages; * turn ifacecnt into a static variable; * use eigrp_addrcmp() on if_deladdr() to avoid code duplication; * s/route_print_origin/log_route_origin/ * more smaller issues.
2016-02-23I just stumbled on this and noticed that eigrpd requires inet and rpath in ↵Gleydson Soares
pledge(2) call to make "reload", without that, daemon will crash on SIGHUP signal.... as discurssed/OK renato@ commit it now, deraadt@
2016-02-21Skip redistributed routes when updating the FIB.Renato Westphal
2016-02-21Move some functions around and rename a few variables and functions.Renato Westphal
The sooner we do these changes the better. This rearrangement will make the code easier to read.
2016-02-21Simplify the handling of the sequence tlv.Renato Westphal
The C standard says: "A pointer to a union object, suitably converted, points to each of its members". This means that we can use the same code to process both v4 and v6 addresses.
2016-02-21Copy structs by assignment instead of memcpy.Renato Westphal
Copying by straight assignment is shorter, easier to read and has a higher level of abstraction. We'll only avoid it when copying from an unaligned source (e.g., network buffers).
2016-02-21Introduce the bad_addr() family of functions.Renato Westphal
These functions improve code reusability as there's no more need to check for all possible "bad" addresses in several different places. Besides that, this patch introduce additional checks in the code.
2016-02-21Extend eigrp_addrcmp() and use it in more places.Renato Westphal
The idea is to remove unnecessary code duplication throughout the code.
2016-02-21Several minor tweaks.Renato Westphal
2016-02-21Add scope id only for unicast IPv6 packets.Renato Westphal
2016-02-21Make eigrpd work against newer IOS routers.Renato Westphal
Different versions of IOS can use a different number of bytes to encode the same IPv6 prefix inside route TLVs. This sucks but we have to deal with it. Instead of calculating the number of bytes based on the value of the prefixlen field, let's get this number by subtracting the size of all other fields from the total size of the TLV. It works because all the other fields have a fixed length. For reference, the EIGRP draft says that length of the prefix field should be obtained according to this function: ((Bit Count - 1) / 8) + 1 But older IOS versions use this for IPv6 (obtained through reverse engineering): ((Bit Count == 128) ? 16 : ((Bit Count / 8) + 1)) Now, the new IOS-XR apparently uses the first formula for both IPv4 and IPv6. With this patch, eigrpd will work against both older and newer versions of IOS.
2016-02-21Filter our RTM_GET messages which are not from us.Renato Westphal
Pulled from ospfd. Original author: claudio@
2016-02-02Remove setproctitle() for the parent process. Because rc.d(8) uses processStuart Henderson
titles (including flags) to distinguish between daemons, this makes it possible to manage multiple copies of a daemon using the normal infrastructure by symlinking rc.d scripts to a new name. ok jung@ ajacoutot@, smtpd ok gilles@
2016-01-28Correct bit flag tests to work as intended.Jonathan Gray
ok renato@
2016-01-15For each prefix, order routes by their nexthop.Renato Westphal
2016-01-15Better handle explicit nexthops.Renato Westphal
If an explicit nexthop was advertised for a route, show it in the 'eigrpctl show topology' command output instead of the address of the advertising neighbor (implicit nexthop).