aboutsummaryrefslogtreecommitdiff
path: root/sbin/route
diff options
context:
space:
mode:
authorAlexander V. Chernikov <melifaro@FreeBSD.org>2014-10-31 13:37:47 +0000
committerAlexander V. Chernikov <melifaro@FreeBSD.org>2014-10-31 13:37:47 +0000
commitad4278e8fd8e9c8023fc7945cec26c67a0bfd97a (patch)
tree1aacc8a17a4eba06b1224c31e69ccc143d231687 /sbin/route
parentf5196a58a05f48bde45498dfe98c0d595de8dbf5 (diff)
downloadsrc-ad4278e8fd8e9c8023fc7945cec26c67a0bfd97a.tar.gz
src-ad4278e8fd8e9c8023fc7945cec26c67a0bfd97a.zip
Print human-readable error for "route not found" case.
Submitted by: vsevolod (initial version) MFC after: 2 weeks Sponsored by: Yandex LLC
Notes
Notes: svn path=/head/; revision=273906
Diffstat (limited to 'sbin/route')
-rw-r--r--sbin/route/route.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/sbin/route/route.c b/sbin/route/route.c
index 9b3bb9533f61..21d92b5d68bc 100644
--- a/sbin/route/route.c
+++ b/sbin/route/route.c
@@ -1533,9 +1533,18 @@ rtmsg(int cmd, int flags, int fib)
if (debugonly)
return (0);
if ((rlen = write(s, (char *)&m_rtmsg, l)) < 0) {
- if (errno == EPERM)
+ switch (errno) {
+ case EPERM:
err(1, "writing to routing socket");
- warn("writing to routing socket");
+ case ESRCH:
+ warnx("route has not been found");
+ break;
+ case EEXIST:
+ /* Handled by newroute() */
+ break;
+ default:
+ warn("writing to routing socket");
+ }
return (-1);
}
if (cmd == RTM_GET) {