aboutsummaryrefslogtreecommitdiff
path: root/sys/net/rtsock.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/net/rtsock.c')
-rw-r--r--sys/net/rtsock.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c
index 26b888f21532..e21af57b40de 100644
--- a/sys/net/rtsock.c
+++ b/sys/net/rtsock.c
@@ -674,12 +674,15 @@ route_output(struct mbuf *m, struct socket *so, ...)
case RTM_ADD:
case RTM_CHANGE:
- if (info.rti_info[RTAX_GATEWAY] == NULL)
- senderr(EINVAL);
+ if (rtm->rtm_type == RTM_ADD) {
+ if (info.rti_info[RTAX_GATEWAY] == NULL)
+ senderr(EINVAL);
+ }
saved_nrt = NULL;
/* support for new ARP code */
- if (info.rti_info[RTAX_GATEWAY]->sa_family == AF_LINK &&
+ if (info.rti_info[RTAX_GATEWAY] != NULL &&
+ info.rti_info[RTAX_GATEWAY]->sa_family == AF_LINK &&
(rtm->rtm_flags & RTF_LLDATA) != 0) {
error = lla_rt_output(rtm, &info);
#ifdef INET6