Hi,

in rev 1.273 RTM_LOCK has been removed from net/rtsock.c.  Since
then the big switch in rtm_output() has RTM_CHANGE as a single case.
It does not make sense to check rtm_type again.

For easier review I provide the diff -w output.  Otherwise you would
mostly see the indent change.

ok?

bluhm

Index: net/rtsock.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/net/rtsock.c,v
retrieving revision 1.289
diff -u -p -w -r1.289 rtsock.c
--- net/rtsock.c        17 Jul 2019 19:57:32 -0000      1.289
+++ net/rtsock.c        28 Aug 2019 16:41:37 -0000
@@ -977,8 +977,7 @@ rtm_output(struct rt_msghdr *rtm, struct
                 * If RTAX_GATEWAY is the argument we're trying to
                 * change, try to find a compatible route.
                 */
-               if ((rt == NULL) && (info->rti_info[RTAX_GATEWAY] != NULL) &&
-                   (rtm->rtm_type == RTM_CHANGE)) {
+               if ((rt == NULL) && (info->rti_info[RTAX_GATEWAY] != NULL)) {
                        rt = rtable_lookup(tableid, info->rti_info[RTAX_DST],
                            info->rti_info[RTAX_NETMASK], NULL, prio);
                        /* Ensure we don't pick a multipath one. */
@@ -1003,7 +1002,7 @@ rtm_output(struct rt_msghdr *rtm, struct
                }

                /*
-                * RTM_CHANGE/LOCK need a perfect match.
+                * RTM_CHANGE needs a perfect match.
                 */
                plen = rtable_satoplen(info->rti_info[RTAX_DST]->sa_family,
                    info->rti_info[RTAX_NETMASK]);
@@ -1012,8 +1011,6 @@ rtm_output(struct rt_msghdr *rtm, struct
                        break;
                }

-               switch (rtm->rtm_type) {
-               case RTM_CHANGE:
                        if (info->rti_info[RTAX_GATEWAY] != NULL)
                                if (rt->rt_gateway == NULL ||
                                    bcmp(rt->rt_gateway,
@@ -1128,8 +1125,6 @@ change:
                        rt->rt_locks |=
                            (rtm->rtm_inits & rtm->rtm_rmx.rmx_locks);
                        NET_UNLOCK();
-                       break;
-               }
                break;
        case RTM_GET:
                rt = rtable_lookup(tableid, info->rti_info[RTAX_DST],

Reply via email to