kernel route 64 bit expire time

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

kernel route 64 bit expire time

Alexander Bluhm
Hi,

Convert the route expire timestamp in kernel and routing message
to 64 bit.  Add a small compatibility layer that allows to set
routes with old user land and new kernel.

ok?

bluhm

Index: net/route.h
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/net/route.h,v
retrieving revision 1.78
diff -u -p -u -p -r1.78 route.h
--- net/route.h 19 Sep 2012 16:14:01 -0000 1.78
+++ net/route.h 14 Oct 2013 18:19:10 -0000
@@ -61,10 +61,9 @@ struct route {
  */
 struct rt_kmetrics {
  u_int64_t rmx_pksent; /* packets sent using this route */
+ int64_t rmx_expire; /* lifetime for route, e.g. redirect */
  u_int rmx_locks; /* Kernel must leave these values */
  u_int rmx_mtu; /* MTU for this path */
- u_int rmx_expire; /* lifetime for route, e.g. redirect */
- u_int rmx_pad;
 };
 
 /*
@@ -72,9 +71,9 @@ struct rt_kmetrics {
  */
 struct rt_metrics {
  u_int64_t rmx_pksent; /* packets sent using this route */
+ int64_t rmx_expire; /* lifetime for route, e.g. redirect */
  u_int rmx_locks; /* Kernel must leave these values */
  u_int rmx_mtu; /* MTU for this path */
- u_int rmx_expire; /* lifetime for route, e.g. redirect */
  u_int rmx_refcnt; /* # references hold */
  /* some apps may still need these no longer used metrics */
  u_int rmx_hopcount; /* max hops expected */
@@ -83,6 +82,7 @@ struct rt_metrics {
  u_int rmx_ssthresh; /* outbound gateway buffer limit */
  u_int rmx_rtt; /* estimated round trip time */
  u_int rmx_rttvar; /* estimated rtt variance */
+ u_int rmx_pad;
 };
 
 /*
@@ -214,7 +214,47 @@ struct rt_msghdr {
 /* overload no longer used field */
 #define rtm_use rtm_rmx.rmx_pksent
 
-#define RTM_VERSION 4 /* Up the ante and ignore older versions */
+#if defined(_KERNEL) && ! defined(SMALL_KERNEL)
+/*
+ * Compatibility structures for version 4 messages.
+ * Remove them after OpenBSD 5.5.
+ */
+struct rt_ometrics {
+ u_int64_t rmx_pksent; /* packets sent using this route */
+ u_int rmx_locks; /* Kernel must leave these values */
+ u_int rmx_mtu; /* MTU for this path */
+ u_int rmx_expire; /* lifetime for route, e.g. redirect */
+ u_int rmx_refcnt; /* # references hold */
+ /* some apps may still need these no longer used metrics */
+ u_int rmx_hopcount; /* max hops expected */
+ u_int rmx_recvpipe; /* inbound delay-bandwidth product */
+ u_int rmx_sendpipe; /* outbound delay-bandwidth product */
+ u_int rmx_ssthresh; /* outbound gateway buffer limit */
+ u_int rmx_rtt; /* estimated round trip time */
+ u_int rmx_rttvar; /* estimated rtt variance */
+};
+struct rt_omsghdr {
+ u_short rtm_msglen; /* to skip over non-understood messages */
+ u_char rtm_version; /* future binary compatibility */
+ u_char rtm_type; /* message type */
+ u_short rtm_hdrlen; /* sizeof(rt_msghdr) to skip over the header */
+ u_short rtm_index; /* index for associated ifp */
+ u_short rtm_tableid; /* routing table id */
+ u_char rtm_priority; /* routing priority */
+ u_char rtm_mpls; /* MPLS additional infos */
+ int rtm_addrs; /* bitmask identifying sockaddrs in msg */
+ int rtm_flags; /* flags, incl. kern & message, e.g. DONE */
+ int rtm_fmask; /* bitmask used in RTM_CHANGE message */
+ pid_t rtm_pid; /* identify sender */
+ int rtm_seq; /* for sender to identify action */
+ int rtm_errno; /* why failed */
+ u_int rtm_inits; /* which metrics we are initializing */
+ struct rt_ometrics rtm_rmx; /* metrics themselves */
+};
+#define RTM_OVERSION 4 /* Provide backward compatibility */
+#endif /* defined(_KERNEL) && ! defined(SMALL_KERNEL) */
+
+#define RTM_VERSION 5 /* Up the ante and ignore older versions */
 
 #define RTM_MAXSIZE 2048 /* Maximum size of an accepted route msg */
 
Index: net/rtsock.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/net/rtsock.c,v
retrieving revision 1.127
diff -u -p -u -p -r1.127 rtsock.c
--- net/rtsock.c 28 Aug 2013 06:58:57 -0000 1.127
+++ net/rtsock.c 14 Oct 2013 22:31:58 -0000
@@ -101,6 +101,10 @@ struct mbuf *rt_msg1(int, struct rt_addr
 int rt_msg2(int, int, struct rt_addrinfo *, caddr_t,
      struct walkarg *);
 void rt_xaddrs(caddr_t, caddr_t, struct rt_addrinfo *);
+#ifdef RTM_OVERSION
+struct rt_msghdr *rtmsg_4to5(struct mbuf *, int *);
+void rt_ogetmetrics(struct rt_kmetrics *in, struct rt_ometrics *out);
+#endif /* RTM_OVERSION */
 
 /* Sleazy use of local variables throughout file, warning!!!! */
 #define dst info.rti_info[RTAX_DST]
@@ -480,6 +484,23 @@ route_output(struct mbuf *m, ...)
  goto fail;
  }
  switch (mtod(m, struct rt_msghdr *)->rtm_version) {
+#ifdef RTM_OVERSION
+ case RTM_OVERSION:
+ if (len < sizeof(struct rt_omsghdr)) {
+ error = EINVAL;
+ goto fail;
+ }
+ if (len > RTM_MAXSIZE) {
+ error = EMSGSIZE;
+ goto fail;
+ }
+ rtm = rtmsg_4to5(m, &len);
+ if (rtm == 0) {
+ error = ENOBUFS;
+ goto fail;
+ }
+ break;
+#endif /* RTM_OVERSION */
  case RTM_VERSION:
  if (len < sizeof(struct rt_msghdr)) {
  error = EINVAL;
@@ -935,6 +956,18 @@ rt_getmetrics(struct rt_kmetrics *in, st
  out->rmx_pksent = in->rmx_pksent;
 }
 
+#ifdef RTM_OVERSION
+void
+rt_ogetmetrics(struct rt_kmetrics *in, struct rt_ometrics *out)
+{
+ bzero(out, sizeof(*out));
+ out->rmx_locks = in->rmx_locks;
+ out->rmx_mtu = in->rmx_mtu;
+ out->rmx_expire = (u_int)in->rmx_expire;
+ out->rmx_pksent = in->rmx_pksent;
+}
+#endif /* RTM_OVERSION */
+
 #define ROUNDUP(a) \
  ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
 #define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len))
@@ -1031,6 +1064,11 @@ again:
  len = sizeof(struct if_msghdr);
  break;
  default:
+#ifdef RTM_OVERSION
+ if (vers == RTM_OVERSION)
+ len = sizeof(struct rt_omsghdr);
+ else
+#endif /* RTM_OVERSION */
  len = sizeof(struct rt_msghdr);
  break;
  }
@@ -1075,6 +1113,16 @@ again:
  if (cp && w) /* clear the message header */
  bzero(cp0, hlen);
 
+#ifdef RTM_OVERSION
+ if (cp && vers == RTM_OVERSION) {
+ struct rt_omsghdr *rtm = (struct rt_omsghdr *)cp0;
+
+ rtm->rtm_version = RTM_OVERSION;
+ rtm->rtm_type = type;
+ rtm->rtm_msglen = len;
+ rtm->rtm_hdrlen = hlen;
+ } else
+#endif /* RTM_OVERSION */
  if (cp) {
  struct rt_msghdr *rtm = (struct rt_msghdr *)cp0;
 
@@ -1311,6 +1359,27 @@ sysctl_dumpentry(struct radix_node *rn,
  else
  w->w_where += size;
  }
+#ifdef RTM_OVERSION
+ size = rt_msg2(RTM_GET, RTM_OVERSION, &info, NULL, w);
+ if (w->w_where && w->w_tmem && w->w_needed <= 0) {
+ struct rt_omsghdr *rtm = (struct rt_omsghdr *)w->w_tmem;
+
+ rtm->rtm_flags = rt->rt_flags;
+ rtm->rtm_priority = rt->rt_priority & RTP_MASK;
+ rt_ogetmetrics(&rt->rt_rmx, &rtm->rtm_rmx);
+ rtm->rtm_rmx.rmx_refcnt = rt->rt_refcnt;
+ rtm->rtm_index = rt->rt_ifp->if_index;
+ rtm->rtm_addrs = info.rti_addrs;
+ rtm->rtm_tableid = id;
+#ifdef MPLS
+ rtm->rtm_mpls = info.rti_mpls;
+#endif
+ if ((error = copyout(rtm, w->w_where, size)) != 0)
+ w->w_where = NULL;
+ else
+ w->w_where += size;
+ }
+#endif
  return (error);
 }
 
@@ -1345,6 +1414,23 @@ sysctl_iflist(int af, struct walkarg *w)
  return (error);
  w->w_where += len;
  }
+#ifdef RTM_OVERSION
+ len = rt_msg2(RTM_IFINFO, RTM_OVERSION, &info, 0, w);
+ if (w->w_where && w->w_tmem && w->w_needed <= 0) {
+ struct if_msghdr *ifm;
+
+ ifm = (struct if_msghdr *)w->w_tmem;
+ ifm->ifm_index = ifp->if_index;
+ ifm->ifm_tableid = ifp->if_rdomain;
+ ifm->ifm_flags = ifp->if_flags;
+ ifm->ifm_data = ifp->if_data;
+ ifm->ifm_addrs = info.rti_addrs;
+ error = copyout(ifm, w->w_where, len);
+ if (error)
+ return (error);
+ w->w_where += len;
+ }
+#endif /* RTM_OVERSION */
  ifpaddr = 0;
  while ((ifa = TAILQ_NEXT(ifa, ifa_list)) != NULL) {
  if (af && af != ifa->ifa_addr->sa_family)
@@ -1366,6 +1452,22 @@ sysctl_iflist(int af, struct walkarg *w)
  return (error);
  w->w_where += len;
  }
+#ifdef RTM_OVERSION
+ len = rt_msg2(RTM_NEWADDR, RTM_OVERSION, &info, 0, w);
+ if (w->w_where && w->w_tmem && w->w_needed <= 0) {
+ struct ifa_msghdr *ifam;
+
+ ifam = (struct ifa_msghdr *)w->w_tmem;
+ ifam->ifam_index = ifa->ifa_ifp->if_index;
+ ifam->ifam_flags = ifa->ifa_flags;
+ ifam->ifam_metric = ifa->ifa_metric;
+ ifam->ifam_addrs = info.rti_addrs;
+ error = copyout(w->w_tmem, w->w_where, len);
+ if (error)
+ return (error);
+ w->w_where += len;
+ }
+#endif /* RTM_OVERSION */
  }
  ifaaddr = netmask = brdaddr = 0;
  }
@@ -1450,6 +1552,50 @@ sysctl_rtable(int *name, u_int namelen,
 
  return (error);
 }
+
+#ifdef RTM_OVERSION
+struct rt_msghdr *
+rtmsg_4to5(struct mbuf *m, int *len)
+{
+ struct rt_msghdr *rtm;
+ struct rt_omsghdr *ortm;
+
+ *len += sizeof(struct rt_msghdr) - sizeof(struct rt_omsghdr);
+ R_Malloc(rtm, struct rt_msghdr *, *len);
+ if (rtm == 0)
+ return (NULL);
+ bzero(rtm, sizeof(struct rt_msghdr));
+ ortm = mtod(m, struct rt_omsghdr *);
+ rtm->rtm_msglen = *len;
+ rtm->rtm_version = RTM_VERSION;
+ rtm->rtm_type = ortm->rtm_type;
+ rtm->rtm_hdrlen = sizeof(struct rt_msghdr);
+
+ rtm->rtm_index = ortm->rtm_index;
+ rtm->rtm_tableid = ortm->rtm_tableid;
+ rtm->rtm_priority = ortm->rtm_priority;
+ rtm->rtm_mpls = ortm->rtm_mpls;
+ rtm->rtm_addrs = ortm->rtm_addrs;
+ rtm->rtm_flags = ortm->rtm_flags;
+ rtm->rtm_fmask = ortm->rtm_fmask;
+ rtm->rtm_pid = ortm->rtm_pid;
+ rtm->rtm_seq = ortm->rtm_seq;
+ rtm->rtm_errno = ortm->rtm_errno;
+ rtm->rtm_inits = ortm->rtm_inits;
+
+ /* copy just the interesting stuff ignore the rest */
+ rtm->rtm_rmx.rmx_pksent = ortm->rtm_rmx.rmx_pksent;
+ rtm->rtm_rmx.rmx_expire = (int64_t)ortm->rtm_rmx.rmx_expire;
+ rtm->rtm_rmx.rmx_locks = ortm->rtm_rmx.rmx_locks;
+ rtm->rtm_rmx.rmx_mtu = ortm->rtm_rmx.rmx_mtu;
+
+ m_copydata(m, sizeof(struct rt_omsghdr),
+    *len - sizeof(struct rt_msghdr),
+    (caddr_t)rtm + sizeof(struct rt_msghdr));
+
+ return (rtm);
+}
+#endif /* RTM_OVERSION */
 
 /*
  * Definitions of protocols supported in the ROUTE domain.
Index: netinet/if_ether.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/if_ether.c,v
retrieving revision 1.108
diff -u -p -u -p -r1.108 if_ether.c
--- netinet/if_ether.c 14 Oct 2013 16:06:33 -0000 1.108
+++ netinet/if_ether.c 14 Oct 2013 16:10:47 -0000
@@ -1133,7 +1133,7 @@ db_show_radix_node(struct radix_node *rn
 
  db_printf("rtentry=%p", rt);
 
- db_printf(" flags=0x%x refcnt=%d use=%llu expire=%u rtableid %u\n",
+ db_printf(" flags=0x%x refcnt=%d use=%llu expire=%lld rtableid=%u\n",
     rt->rt_flags, rt->rt_refcnt, rt->rt_use, rt->rt_expire, id);
 
  db_printf(" key="); db_print_sa(rt_key(rt));

Reply | Threaded
Open this post in threaded view
|

Re: kernel route 64 bit expire time

Stuart Henderson-6
On 2013/10/15 00:43, Alexander Bluhm wrote:
> Hi,
>
> Convert the route expire timestamp in kernel and routing message
> to 64 bit.  Add a small compatibility layer that allows to set
> routes with old user land and new kernel.

ports-wise, here's output from a search for rt_metrics/rt_kmetrics/rt_msghdr.
for many, making sure they update (e.g. libc bump or explicit port REVISION bump)
is all that's needed, but others e.g. openvpn will need more work.

netperf-2.6.0/netperf-2.6.0/src/netrt_rtmget.c
268:#define BUFLEN (sizeof(struct rt_msghdr) + 512)
275:  struct rt_msghdr  *rtm;
300:  rtm = (struct rt_msghdr *)buffer;
302:  rtm->rtm_msglen = sizeof(struct rt_msghdr);
325:  rtm->rtm_version = RTM_VERSION;
331:  /* point just beyond the rt_msghdr. */
344:    if (ret < sizeof(struct rt_msghdr)) {

llvm-3.3/llvm-3.3.src/test/CodeGen/X86/2009-04-29-LinearScanBug.ll
98:  %struct.rt_metrics = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [4 x i32] }
99:  %struct.rtentry = type { [2 x %struct.radix_node], %struct.sockaddr*, i32, i32, %struct.ifnet*, %struct.ifaddr*, %struct.sockaddr*, i8*, void (i8*)*, %struct.rt_metrics, %struct.rtentry*, %struct.rtentry*, i32, %struct.lck_mtx_t }

ptlib-2.10.10/ptlib-2.10.10/src/ptlib/unix/socket.cxx
1105:PBoolean process_rtentry(struct rt_msghdr *rtm, char *ptr, unsigned long *p_net_addr,
1114:  struct rt_msghdr *rtm;
1160:    rtm = (struct rt_msghdr *)ptr;
1180:PBoolean process_rtentry(struct rt_msghdr *rtm, char *ptr, unsigned long *p_net_addr,

gcc-4.8.1/gcc-4.8.1/libgo/go/syscall/route_bsd.go
188:         if any.Version != RTM_VERSION {

go-1.1.1/go/api/go1.txt
6652:pkg syscall (darwin-386), const RTM_VERSION ideal-int
8470:pkg syscall (darwin-386-cgo), const RTM_VERSION ideal-int
10288:pkg syscall (darwin-amd64), const RTM_VERSION ideal-int
12113:pkg syscall (darwin-amd64-cgo), const RTM_VERSION ideal-int
14155:pkg syscall (freebsd-386), const RTM_VERSION ideal-int
16127:pkg syscall (freebsd-amd64), const RTM_VERSION ideal-int

go-1.1.1/go/src/pkg/syscall/route_bsd.go
179:         if any.Version != RTM_VERSION {

go-1.1.1/go/src/pkg/syscall/types_darwin.go
196: SizeofRtMsghdr    = C.sizeof_struct_rt_msghdr
197: SizeofRtMetrics   = C.sizeof_struct_rt_metrics
210:type RtMsghdr C.struct_rt_msghdr
212:type RtMetrics C.struct_rt_metrics

go-1.1.1/go/src/pkg/syscall/types_freebsd.go
201: SizeofRtMsghdr         = C.sizeof_struct_rt_msghdr
202: SizeofRtMetrics        = C.sizeof_struct_rt_metrics
215:type RtMsghdr C.struct_rt_msghdr
217:type RtMetrics C.struct_rt_metrics

go-1.1.1/go/src/pkg/syscall/types_netbsd.go
178: SizeofRtMsghdr         = C.sizeof_struct_rt_msghdr
179: SizeofRtMetrics        = C.sizeof_struct_rt_metrics
190:type RtMsghdr C.struct_rt_msghdr
192:type RtMetrics C.struct_rt_metrics

go-1.1.1/go/src/pkg/syscall/types_openbsd.go
194: SizeofRtMsghdr         = C.sizeof_struct_rt_msghdr
195: SizeofRtMetrics        = C.sizeof_struct_rt_metrics
206:type RtMsghdr C.struct_rt_msghdr
208:type RtMetrics C.struct_rt_metrics

go-1.1.1/go/src/pkg/syscall/zerrors_darwin_386.go
841: RTM_VERSION                       = 0x5

go-1.1.1/go/src/pkg/syscall/zerrors_darwin_amd64.go
841: RTM_VERSION                       = 0x5

go-1.1.1/go/src/pkg/syscall/zerrors_netbsd_386.go
1109:        RTM_VERSION                       = 0x4

go-1.1.1/go/src/pkg/syscall/zerrors_freebsd_386.go
1162:        RTM_VERSION                       = 0x5

go-1.1.1/go/src/pkg/syscall/zerrors_freebsd_amd64.go
1162:        RTM_VERSION                       = 0x5

go-1.1.1/go/src/pkg/syscall/zerrors_freebsd_arm.go
1167:        RTM_VERSION                       = 0x5

go-1.1.1/go/src/pkg/syscall/zerrors_netbsd_amd64.go
1099:        RTM_VERSION                       = 0x4

go-1.1.1/go/src/pkg/syscall/zerrors_openbsd_amd64.go
1006:        RTM_VERSION                       = 0x4

go-1.1.1/go/src/pkg/syscall/zerrors_openbsd_386.go
1000:        RTM_VERSION                       = 0x4

go-1.1.1/go/src/pkg/syscall/zerrors_netbsd_arm.go
1099:        RTM_VERSION                       = 0x4

fetchmail-6.3.24/fetchmail-6.3.24/interface.c
445: if (ifm->ifm_version != RTM_VERSION)

avahi-0.6.31/avahi-0.6.31/avahi-core/iface-pfroute.c
60:static void rtm_info(struct rt_msghdr *rtm, AvahiInterfaceMonitor *m)
119:static void rtm_addr(struct rt_msghdr *rtm, AvahiInterfaceMonitor *m)
237:static void parse_rtmsg(struct rt_msghdr *rtm, AvahiInterfaceMonitor *m)
242:  if (rtm->rtm_version != RTM_VERSION) {
279:      parse_rtmsg((struct rt_msghdr *)msg, m);
457:  struct rt_msghdr *rtm;
490:    rtm = (struct rt_msghdr *)next;

avahi-0.6.31/avahi-0.6.31/avahi-autoipd/iface-bsd.c
85:        struct rt_msghdr                 rtm;
233:        struct rt_msghdr *rtm;
274:                if (rtm->rtm_version != RTM_VERSION) {

bird-1.3.10/bird-1.3.10/sysdep/bsd/krt-sock.c
43:  struct rt_msghdr rtm;
98:  bzero(&msg,sizeof (struct rt_msghdr));
99:  msg.rtm.rtm_version = RTM_VERSION;

bird-1.3.10-v6/bird-1.3.10/sysdep/bsd/krt-sock.c
43:  struct rt_msghdr rtm;
98:  bzero(&msg,sizeof (struct rt_msghdr));
99:  msg.rtm.rtm_version = RTM_VERSION;

dnsmasq-2.66/dnsmasq-2.66/src/bpf.c
41:  struct rt_msghdr *rtm;
77:      rtm = (struct rt_msghdr *)next;

gtk-gnutella-0.97.1/gtk-gnutella-0.97.1/src/lib/getgateway.c
293:         struct rt_msghdr head;
296: struct rt_msghdr * const rt = &rtm.head;
313: rt->rtm_version = RTM_VERSION;

ipcad-3.7.3/ipcad-3.7.3/loop-dynamic.c
43:  struct rt_msghdr *rtm;
99:          if(rtm->rtm_version != RTM_VERSION) {

libdnet-1.12/libdnet-1.12/aclocal.m4
6823:dnl Check for rt_msghdr struct in <net/route.h>
6829:    [AC_MSG_CHECKING(for rt_msghdr struct in <net/route.h>)
6830:    AC_CACHE_VAL(ac_cv_dnet_route_h_has_rt_msghdr,
6836:        [struct rt_msghdr rtm; rtm.rtm_msglen = 0;],
6837:        ac_cv_dnet_route_h_has_rt_msghdr=yes,
6838:        ac_cv_dnet_route_h_has_rt_msghdr=no))
6839:    AC_MSG_RESULT($ac_cv_dnet_route_h_has_rt_msghdr)
6840:    if test $ac_cv_dnet_route_h_has_rt_msghdr = yes ; then
6842:                  [Define if <net/route.h> has rt_msghdr struct.])

libdnet-1.12/libdnet-1.12/config/acinclude.m4
70:dnl Check for rt_msghdr struct in <net/route.h>
76:    [AC_MSG_CHECKING(for rt_msghdr struct in <net/route.h>)
77:    AC_CACHE_VAL(ac_cv_dnet_route_h_has_rt_msghdr,
83:        [struct rt_msghdr rtm; rtm.rtm_msglen = 0;],
84:  ac_cv_dnet_route_h_has_rt_msghdr=yes,
85:  ac_cv_dnet_route_h_has_rt_msghdr=no))
86:    AC_MSG_RESULT($ac_cv_dnet_route_h_has_rt_msghdr)
87:    if test $ac_cv_dnet_route_h_has_rt_msghdr = yes ; then
89:            [Define if <net/route.h> has rt_msghdr struct.])

libdnet-1.12/libdnet-1.12/configure.in
221:elif test "$ac_cv_dnet_route_h_has_rt_msghdr" = yes ; then
291:elif test "$ac_cv_dnet_route_h_has_rt_msghdr" = yes ; then

libdnet-1.12/libdnet-1.12/include/config.h.in
136:/* Define if <net/route.h> has rt_msghdr struct. */

libdnet-1.12/libdnet-1.12/src/arp-bsd.c
44:  struct rt_msghdr    rtm;
71:  msg->rtm.rtm_version = RTM_VERSION;
265: struct rt_msghdr *rtm;
290:         rtm = (struct rt_msghdr *)next;

libdnet-1.12/libdnet-1.12/configure
21604:       echo "$as_me:$LINENO: checking for rt_msghdr struct in <net/route.h>" >&5
21605:echo $ECHO_N "checking for rt_msghdr struct in <net/route.h>... $ECHO_C" >&6
21606:    if test "${ac_cv_dnet_route_h_has_rt_msghdr+set}" = set; then
21623:struct rt_msghdr rtm; rtm.rtm_msglen = 0;
21650:  ac_cv_dnet_route_h_has_rt_msghdr=yes
21655:ac_cv_dnet_route_h_has_rt_msghdr=no
21660:    echo "$as_me:$LINENO: result: $ac_cv_dnet_route_h_has_rt_msghdr" >&5
21661:echo "${ECHO_T}$ac_cv_dnet_route_h_has_rt_msghdr" >&6
21662:    if test $ac_cv_dnet_route_h_has_rt_msghdr = yes ; then
22137:elif test "$ac_cv_dnet_route_h_has_rt_msghdr" = yes ; then
22376:elif test "$ac_cv_dnet_route_h_has_rt_msghdr" = yes ; then

libdnet-1.12/libdnet-1.12/src/route-bsd.c
67:route_msg_print(struct rt_msghdr *rtm)
79:  struct rt_msghdr *rtm;
87:  rtm = (struct rt_msghdr *)buf;
88:  rtm->rtm_version = RTM_VERSION;
220: struct rt_msghdr *rtm;
270:         rtm = (struct rt_msghdr *)next;

libdnet-1.12/libdnet-1.12/trunk/config/acinclude.m4
70:dnl Check for rt_msghdr struct in <net/route.h>
76:    [AC_MSG_CHECKING(for rt_msghdr struct in <net/route.h>)
77:    AC_CACHE_VAL(ac_cv_dnet_route_h_has_rt_msghdr,
83:        [struct rt_msghdr rtm; rtm.rtm_msglen = 0;],
84:  ac_cv_dnet_route_h_has_rt_msghdr=yes,
85:  ac_cv_dnet_route_h_has_rt_msghdr=no))
86:    AC_MSG_RESULT($ac_cv_dnet_route_h_has_rt_msghdr)
87:    if test $ac_cv_dnet_route_h_has_rt_msghdr = yes ; then
89:            [Define if <net/route.h> has rt_msghdr struct.])

libdnet-1.12/libdnet-1.12/trunk/configure.in
221:elif test "$ac_cv_dnet_route_h_has_rt_msghdr" = yes ; then
291:elif test "$ac_cv_dnet_route_h_has_rt_msghdr" = yes ; then

libdnet-1.12/libdnet-1.12/trunk/include/config.h.in
136:/* Define if <net/route.h> has rt_msghdr struct. */

libdnet-1.12/libdnet-1.12/trunk/aclocal.m4
7320:dnl Check for rt_msghdr struct in <net/route.h>
7326:    [AC_MSG_CHECKING(for rt_msghdr struct in <net/route.h>)
7327:    AC_CACHE_VAL(ac_cv_dnet_route_h_has_rt_msghdr,
7333:        [struct rt_msghdr rtm; rtm.rtm_msglen = 0;],
7334:        ac_cv_dnet_route_h_has_rt_msghdr=yes,
7335:        ac_cv_dnet_route_h_has_rt_msghdr=no))
7336:    AC_MSG_RESULT($ac_cv_dnet_route_h_has_rt_msghdr)
7337:    if test $ac_cv_dnet_route_h_has_rt_msghdr = yes ; then
7339:                  [Define if <net/route.h> has rt_msghdr struct.])

libdnet-1.12/libdnet-1.12/trunk/configure
21218:       echo "$as_me:$LINENO: checking for rt_msghdr struct in <net/route.h>" >&5
21219:echo $ECHO_N "checking for rt_msghdr struct in <net/route.h>... $ECHO_C" >&6
21220:    if test "${ac_cv_dnet_route_h_has_rt_msghdr+set}" = set; then
21237:struct rt_msghdr rtm; rtm.rtm_msglen = 0;
21264:  ac_cv_dnet_route_h_has_rt_msghdr=yes
21269:ac_cv_dnet_route_h_has_rt_msghdr=no
21274:    echo "$as_me:$LINENO: result: $ac_cv_dnet_route_h_has_rt_msghdr" >&5
21275:echo "${ECHO_T}$ac_cv_dnet_route_h_has_rt_msghdr" >&6
21276:    if test $ac_cv_dnet_route_h_has_rt_msghdr = yes ; then
21751:elif test "$ac_cv_dnet_route_h_has_rt_msghdr" = yes ; then
21990:elif test "$ac_cv_dnet_route_h_has_rt_msghdr" = yes ; then

libdnet-1.12/libdnet-1.12/trunk/src/arp-bsd.c
44:  struct rt_msghdr    rtm;
71:  msg->rtm.rtm_version = RTM_VERSION;
265: struct rt_msghdr *rtm;
290:         rtm = (struct rt_msghdr *)next;

libdnet-1.12/libdnet-1.12/trunk/src/route-bsd.c
67:route_msg_print(struct rt_msghdr *rtm)
79:  struct rt_msghdr *rtm;
87:  rtm = (struct rt_msghdr *)buf;
88:  rtm->rtm_version = RTM_VERSION;
220: struct rt_msghdr *rtm;
270:         rtm = (struct rt_msghdr *)next;

libnatpmp-20120821/libnatpmp-20120821/getgateway.c
195: struct rt_msghdr * rt;
210:                 rt = (struct rt_msghdr *)p;
246:  struct rt_msghdr m_rtm;
257:  struct rt_msghdr *msg_hdr;
265:  memset(&rtm, 0, sizeof(struct rt_msghdr));
269:  rtm.rtm_version = RTM_VERSION;

miniupnpd-1.8/miniupnpd-1.8/bsd/getroute.c
35:    struct rt_msghdr m_rtm;
56:  rtm.rtm_version = RTM_VERSION;
60:  rtm.rtm_msglen = sizeof(struct rt_msghdr) + sizeof(struct sockaddr);

miniupnpd-1.8/miniupnpd-1.8/bsd/ifacewatcher.c
53:  struct rt_msghdr * rtm;
71:  rtm = (struct rt_msghdr *)buf;

minissdpd-1.2/minissdpd-1.2/ifacewatch.c
186: struct rt_msghdr * rtm;
206: rtm = (struct rt_msghdr *)buffer;

mrtd-2.2.2a/mrt-2.2.2a/src/lib/kernel/bsd.c
46:    struct rt_msghdr m_rtm;
80:    struct rt_metrics rt_metrics;
91:    bzero ((char *) &rt_metrics, sizeof (rt_metrics));
218:    m_rtmsg.m_rtm.rtm_version = RTM_VERSION;
221:    m_rtmsg.m_rtm.rtm_rmx = rt_metrics;
282:    struct rt_msghdr *rtm;
356:    rtm = (struct rt_msghdr *) alloca (size);
360:    rtm->rtm_version = RTM_VERSION;
397:    struct rt_msghdr *rtm;
408: rtm = (struct rt_msghdr *) next;
410: if (rtm->rtm_version != RTM_VERSION) {
413:            rtm->rtm_version, RTM_VERSION);

mrtd-2.2.2a/mrt-2.2.2a/src/lib/kernel/solaris.c
559:    struct rt_msghdr m_rtm;
598:    struct rt_metrics rt_metrics;
609:    bzero ((char *) &rt_metrics, sizeof (rt_metrics));
747:    m_rtmsg.m_rtm.rtm_version = RTM_VERSION;
750:    m_rtmsg.m_rtm.rtm_rmx = rt_metrics;
813:    struct rt_msghdr *rtm;
824: rtm = (struct rt_msghdr *) next;
826: if (rtm->rtm_version != RTM_VERSION) {
829:            rtm->rtm_version, RTM_VERSION);

natpmpd-1.4/natpmpd-1.4/natpmpd.c
284: struct rt_msghdr            *rtm = (struct rt_msghdr *)&msg;
293: if (rtm->rtm_version != RTM_VERSION)

netatalk-2.2.3/netatalk-2.2.3/etc/atalkd/route.c
53:    struct rt_msghdr  rtma_rtm;
65:    rtma.rtma_rtm.rtm_version = RTM_VERSION;

nmap-6.25/nmap-6.25/libdnet-stripped/configure
13911:       { $as_echo "$as_me:$LINENO: checking for rt_msghdr struct in <net/route.h>" >&5
13912:$as_echo_n "checking for rt_msghdr struct in <net/route.h>... " >&6; }
13913:    if test "${ac_cv_dnet_route_h_has_rt_msghdr+set}" = set; then
13930:struct rt_msghdr rtm; rtm.rtm_msglen = 0;
13953:  ac_cv_dnet_route_h_has_rt_msghdr=yes
13958:       ac_cv_dnet_route_h_has_rt_msghdr=no
13964:    { $as_echo "$as_me:$LINENO: result: $ac_cv_dnet_route_h_has_rt_msghdr" >&5
13965:$as_echo "$ac_cv_dnet_route_h_has_rt_msghdr" >&6; }
13966:    if test $ac_cv_dnet_route_h_has_rt_msghdr = yes ; then
14665:elif test "$ac_cv_dnet_route_h_has_rt_msghdr" = yes ; then
14793:elif test "$ac_cv_dnet_route_h_has_rt_msghdr" = yes ; then

nmap-6.25/nmap-6.25/libdnet-stripped/src/route-bsd.c
71:route_msg_print(struct rt_msghdr *rtm)
83:  struct rt_msghdr *rtm;
91:  rtm = (struct rt_msghdr *)buf;
92:  rtm->rtm_version = RTM_VERSION;
262: struct rt_msghdr *rtm;
331:         rtm = (struct rt_msghdr *)next;

nmap-6.25/nmap-6.25/libdnet-stripped/src/arp-bsd.c
44:  struct rt_msghdr    rtm;
71:  msg->rtm.rtm_version = RTM_VERSION;
265: struct rt_msghdr *rtm;
290:         rtm = (struct rt_msghdr *)next;

nmap-6.25/nmap-6.25/libdnet-stripped/include/dnet_winconfig.h
140:/* Define if <net/route.h> has rt_msghdr struct. */

nmap-6.25/nmap-6.25/libdnet-stripped/include/config.h.in
142:/* Define if <net/route.h> has rt_msghdr struct. */
314:   rt_msghdr should be padded so their addresses start on a multiple of

nmap-6.25/nmap-6.25/libdnet-stripped/config/acinclude.m4
70:dnl Check for rt_msghdr struct in <net/route.h>
76:    [AC_MSG_CHECKING(for rt_msghdr struct in <net/route.h>)
77:    AC_CACHE_VAL(ac_cv_dnet_route_h_has_rt_msghdr,
83:        [struct rt_msghdr rtm; rtm.rtm_msglen = 0;],
84:  ac_cv_dnet_route_h_has_rt_msghdr=yes,
85:  ac_cv_dnet_route_h_has_rt_msghdr=no))
86:    AC_MSG_RESULT($ac_cv_dnet_route_h_has_rt_msghdr)
87:    if test $ac_cv_dnet_route_h_has_rt_msghdr = yes ; then
89:            [Define if <net/route.h> has rt_msghdr struct.])

nmap-6.25/nmap-6.25/libdnet-stripped/configure.in
224:elif test "$ac_cv_dnet_route_h_has_rt_msghdr" = yes ; then
271:elif test "$ac_cv_dnet_route_h_has_rt_msghdr" = yes ; then

nmap-6.25/nmap-6.25/libdnet-stripped/NMAP_MODIFICATIONS
1291:@@ -76,7 +77,7 @@ route_msg_print(struct rt_msghdr *rtm)
1299:        struct rt_msghdr *rtm;
1351:                rtm = (struct rt_msghdr *)next;

ntp-4.2.6pl5/ntp-4.2.6p5/configure.ac
933:    [for struct rt_msghdr],
934:    [ntp_cv_struct_rt_msghdr],
944:         struct rt_msghdr p;
947: [ntp_cv_struct_rt_msghdr=yes],
948: [ntp_cv_struct_rt_msghdr=no]
971:case "$ntp_cv_struct_rt_msghdr$ntp_cv_rtattr" in
974: [Do we have a routing socket (rt_msghdr or rtattr)?])

ntp-4.2.6pl5/ntp-4.2.6p5/ntpd/ntp_io.c
4393:        struct rt_msghdr *rtm;
4427:             (p + sizeof(struct rt_msghdr)) <= (buffer + cnt);
4429:                rtm = (struct rt_msghdr *)p;
4430:                if (rtm->rtm_version != RTM_VERSION) {
4433:                                rtm->rtm_version, RTM_VERSION);

ntp-4.2.6pl5/ntp-4.2.6p5/config.h.in
291:/* Do we have a routing socket (rt_msghdr or rtattr)? */

ntp-4.2.6pl5/ntp-4.2.6p5/configure
18090:{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct rt_msghdr" >&5
18091:$as_echo_n "checking for struct rt_msghdr... " >&6; }
18092:if ${ntp_cv_struct_rt_msghdr+:} false; then :
18107:               struct rt_msghdr p;
18115:  ntp_cv_struct_rt_msghdr=yes
18117:  ntp_cv_struct_rt_msghdr=no
18123:{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ntp_cv_struct_rt_msghdr" >&5
18124:$as_echo "$ntp_cv_struct_rt_msghdr" >&6; }
18161:case "$ntp_cv_struct_rt_msghdr$ntp_cv_rtattr" in

ntp-4.2.6pl5/ntp-4.2.6p5/CommitLog
63107:  Fix the configure.ac check for rt_msghdr
63110:    Fix the configure.ac check for rt_msghdr
66462:  look for net/route.h and struct rt_msghdr
66465:    look for net/route.h and struct rt_msghdr

olsrd-0.6.0/olsrd-0.6.0/src/bsd/kernel_routes.c
68: *  - a header i.e. struct rt_msghdr
74:  struct rt_msghdr *rtm;               /* message to send to the routing socket */
106:  rtm = (struct rt_msghdr *)buff;
108:  rtm->rtm_version = RTM_VERSION;
116:  walker = buff + sizeof(struct rt_msghdr);
231:  struct rt_msghdr *rtm;
263:  rtm = (struct rt_msghdr *)buff;
264:  rtm->rtm_version = RTM_VERSION;
272:  walker = buff + sizeof(struct rt_msghdr);
347:    struct rt_msghdr *drtm;
351:    drtm = (struct rt_msghdr *)dbuff;
352:    drtm->rtm_version = RTM_VERSION;
358:    walker = dbuff + sizeof(struct rt_msghdr);

openmdns-0.5/openmdns-0.5/mdnsd/kiface.c
169:         if (ifm.ifm_version != RTM_VERSION)
257: struct rt_msghdr    *rtm;
270:         rtm = (struct rt_msghdr *)next;
271:         if (rtm->rtm_version != RTM_VERSION)

openvpn-2.3.1/openvpn-2.3.1/src/openvpn/route.c
2606:#define RTM_VERSION 5
2615:struct rt_metrics {
2632:struct rt_msghdr {
2644:        struct  rt_metrics rtm_rmx; /* metrics themselves */
2648:  struct rt_msghdr m_rtm;
2666:  struct  rt_msghdr *rtm_aux;
2685:  bzero(&rtm, sizeof(struct rt_msghdr));
2689:  rtm.rtm_version = RTM_VERSION;
2760:  struct rt_msghdr m_rtm;
2786:  struct  rt_msghdr *rtm_aux;
2800:  bzero(&rtm, sizeof(struct rt_msghdr));
2804:  rtm.rtm_version = RTM_VERSION;
2973:#define RTM_VERSION 3       /* Up the ante and ignore older versions */
2981:struct rt_metrics {
2997:struct rt_msghdr {
3009:        struct  rt_metrics rtm_rmx; /* metrics themselves */
3013:  struct rt_msghdr m_rtm;
3032:  struct  rt_msghdr *rtm_aux;
3051:  bzero(&rtm, sizeof(struct rt_msghdr));
3055:  rtm.rtm_version = RTM_VERSION;

p5-Net-RawIP-0.25/Net-RawIP-0.25/eth.c
197:    struct rt_msghdr *rtm;
216:        rtm = (struct rt_msghdr *)next;

p5-Net-RawIP-0.25/Net-RawIP-0.25/rdev.c
111: register struct rt_msghdr *rtm;
134:         rtm = (struct rt_msghdr *)next;

pidgin-2.10.7/pidgin-2.10.7/libpurple/nat-pmp.c
182: struct rt_msghdr *rtm;
218:         rtm = (struct rt_msghdr *)next;

pidgin-2.10.7-gtkspell/pidgin-2.10.7/libpurple/nat-pmp.c
182: struct rt_msghdr *rtm;
218:         rtm = (struct rt_msghdr *)next;

quagga-0.99.22.1/quagga-0.99.22.1/zebra/kernel_socket.c
756:rtm_read_mesg (struct rt_msghdr *rtm,
769:  /* rt_msghdr version check. */
770:  if (rtm->rtm_version != RTM_VERSION)
773:       "This may cause problem\n", rtm->rtm_version, RTM_VERSION);
803:rtm_read (struct rt_msghdr *rtm)
1013:  /* Struct of rt_msghdr and buffer for storing socket's data. */
1016:    struct rt_msghdr rtm;
1023:  /* Clear and set rt_msghdr values */
1024:  memset (&msg, 0, sizeof (struct rt_msghdr));
1025:  msg.rtm.rtm_version = RTM_VERSION;
1136:rtmsg_debug (struct rt_msghdr *rtm)
1159:  struct rt_msghdr *rtm;
1175:      struct rt_msghdr rtm;

quagga-0.99.22.1/quagga-0.99.22.1/zebra/kernel_socket.h
26:extern void rtm_read (struct rt_msghdr *);

quagga-0.99.22.1/quagga-0.99.22.1/zebra/rtread_sysctl.c
38:  struct rt_msghdr *rtm;
70:      rtm = (struct rt_msghdr *) buf;

scamper-0.0.20111202b/scamper-cvs-20111202b/scamper/scamper_addr2mac.c
440:  struct rt_msghdr      *rtm;
484:      rtm = (struct rt_msghdr *)(buf + j); j += sizeof(struct rt_msghdr);
530:      rtm = (struct rt_msghdr *)(buf + j); j += sizeof(struct rt_msghdr);

scamper-0.0.20111202b/scamper-cvs-20111202b/scamper/scamper_rtsock.c
256:  struct rt_msghdr *rtm;
272:  len = sizeof(struct rt_msghdr) + rt_roundup(slen) +
278:  rtm = (struct rt_msghdr *)buf;
280:  rtm->rtm_version = RTM_VERSION;
285:  memcpy(buf + sizeof(struct rt_msghdr), &sas, (size_t)slen);
287:  sdl = (struct sockaddr_dl *)(buf+sizeof(struct rt_msghdr)+rt_roundup(slen));
533:  struct rt_msghdr   *rtm;
548:      if(len - x < sizeof(struct rt_msghdr))
550:   scamper_debug(__func__,"len %d != %d",len,sizeof(struct rt_msghdr));
558:      rtm = (struct rt_msghdr *)(buf + x);
582:      off = sizeof(struct rt_msghdr);

trafshow-3.1/trafshow-3.1/getarptab.c
43:  struct rt_msghdr *rtm;
61:          rtm = (struct rt_msghdr *)next;

transmission-2.80/transmission-2.80/third-party/libnatpmp/getgateway.c
195: struct rt_msghdr * rt;
210:                 rt = (struct rt_msghdr *)p;
246:  struct rt_msghdr m_rtm;
257:  struct rt_msghdr *msg_hdr;
265:  memset(&rtm, 0, sizeof(struct rt_msghdr));
269:  rtm.rtm_version = RTM_VERSION;

wmifinfo-0.09/wmifinfo-0.09/wmifinfo.c
521: struct rt_msghdr *rtm = NULL;
552:                 rtm = (struct rt_msghdr *)next;

xorp-1.6/xorp-1.6/configure
33499:    int rtm_version = RTM_VERSION;

xorp-1.6/xorp-1.6/contrib/win32/xorprtm/test_monitor.c
43:extern void print_rtmsg(struct rt_msghdr *, int);     /* XXX client_rtmsg.c */
85:          print_rtmsg((struct rt_msghdr *) msg, n);

xorp-1.6/xorp-1.6/contrib/win32/xorprtm/print_rtmsg.c
124:struct   rt_metrics rt_metrics;
474: struct  rt_msghdr m_rtm;
517: struct rt_msghdr *rtm;
528: if (rtm->rtm_version != RTM_VERSION) {
591: struct rt_msghdr *rtm;
601: if (rtm->rtm_version != RTM_VERSION) {
664: struct rt_msghdr *rtm;

xorp-1.6/xorp-1.6/contrib/win32/xorprtm/test_routeaddwait.c
43:extern void print_rtmsg(struct rt_msghdr *, int);       /* XXX client_rtmsg.c */
50:  struct rt_msghdr *msg;
85:        msg->rtm_version = RTM_VERSION;

xorp-1.6/xorp-1.6/contrib/win32/xorprtm/test_routeadd.c
48:  struct rt_msghdr *msg;
83:        msg->rtm_version = RTM_VERSION;

xorp-1.6/xorp-1.6/contrib/win32/xorprtm/xorprtm.c
57:int rtm_add_route(struct rt_msghdr *rtm, int msgsize);
152: struct rt_msghdr *rtm;
160: maxmsgsize = sizeof(struct rt_msghdr) + (sizeof(sockunion_t) * 3);
167:         rtm->rtm_version = RTM_VERSION;
780:    struct rt_msghdr *rtm;
823:    rtm = (struct rt_msghdr *)&pp->rbuf[0];
824:    if (rtm->rtm_version != RTM_VERSION) {
832: nbytes < sizeof(struct rt_msghdr)) {
1459:rtm_add_route(struct rt_msghdr *rtm, int msgsize)
1461:    static const proper_msgsize = (sizeof(struct rt_msghdr) +
1618:rtm_delete_route(struct rt_msghdr *rtm, int msgsize)
1620:    static const min_msgsize = (sizeof(struct rt_msghdr) +
1765:    ifa->ifan_version = RTM_VERSION;        /* XXX should set to 0 or ignore */
1805:    ifm->ifm_version = RTM_VERSION;
1875:        ifam->ifam_version = RTM_VERSION;

xorp-1.6/xorp-1.6/contrib/win32/xorprtm/test_routeadddelete.c
43:extern void print_rtmsg(struct rt_msghdr *, int);       /* XXX client_rtmsg.c */
50:  struct rt_msghdr *msg;
51:  struct rt_msghdr *dmsg;
94:        msg->rtm_version = RTM_VERSION;
120:        dmsg->rtm_version = RTM_VERSION;

xorp-1.6/xorp-1.6/contrib/win32/xorprtm/bsdroute.h
152:struct rt_metrics {
159:struct rt_msghdr {
172: struct  rt_metrics rtm_rmx; /* metrics themselves */
175:#define RTM_VERSION  66      /* Unique to XORP/Win32 */

xorp-1.6/xorp-1.6/config/acsocket.m4
241:    int rtm_version = RTM_VERSION;

xorp-1.6/xorp-1.6/fea/data_plane/ifconfig/ifconfig_parse_routing_socket.cc
219: if (ifm->ifm_version != RTM_VERSION) {
224:     // RTM_VERSION and once as RTM_OVERSION, hence we need to ignore
231:                RTM_VERSION,

xorp-1.6/xorp-1.6/fea/data_plane/fibconfig/fibconfig_entry_get_routing_socket.cc
157:    static const size_t  buffer_size = sizeof(struct rt_msghdr) + 512;
160: struct rt_msghdr rtm;
162:    struct rt_msghdr*        rtm = &buffer.rtm;
206:    rtm->rtm_version = RTM_VERSION;
276:    static const size_t  buffer_size = sizeof(struct rt_msghdr) + 512;
279: struct rt_msghdr rtm;
281:    struct rt_msghdr*        rtm = &buffer.rtm;
325:    rtm->rtm_version = RTM_VERSION;

xorp-1.6/xorp-1.6/fea/data_plane/fibconfig/fibconfig_entry_set_routing_socket.cc
149:    static const size_t  buffer_size = sizeof(struct rt_msghdr) + 512;
152: struct rt_msghdr rtm;
154:    struct rt_msghdr*        rtm = &buffer.rtm;
296:    rtm->rtm_version = RTM_VERSION;
402:    static const size_t  buffer_size = sizeof(struct rt_msghdr) + 512;
405: struct rt_msghdr rtm;
407:    struct rt_msghdr*        rtm = &buffer.rtm;
472:    rtm->rtm_version = RTM_VERSION;

xorp-1.6/xorp-1.6/fea/data_plane/fibconfig/fibconfig_entry_get_rtmv2.cc
163:    static const size_t  buffer_size = sizeof(struct rt_msghdr) + 512;
166: struct rt_msghdr rtm;
168:    struct rt_msghdr*        rtm = &buffer.rtm;
212:    rtm->rtm_version = RTM_VERSION;
290:    static const size_t  buffer_size = sizeof(struct rt_msghdr) + 512;
293: struct rt_msghdr rtm;
295:    struct rt_msghdr*        rtm = &buffer.rtm;
339:    rtm->rtm_version = RTM_VERSION;

xorp-1.6/xorp-1.6/fea/data_plane/fibconfig/fibconfig_entry_set_rtmv2.cc
167:    static const size_t  buffer_size = sizeof(struct rt_msghdr)
171: struct rt_msghdr rtm;
173:    struct rt_msghdr*        rtm = &buffer.rtm;
252:    rtm->rtm_version = RTM_VERSION;
288:    static const size_t  buffer_size = sizeof(struct rt_msghdr)
292: struct rt_msghdr rtm;
294:    struct rt_msghdr*        rtm = &buffer.rtm;
336:    rtm->rtm_version = RTM_VERSION;

xorp-1.6/xorp-1.6/fea/data_plane/fibconfig/fibconfig_table_parse_routing_socket.cc
66:    AlignData<struct rt_msghdr> align_data(buffer);
67:    const struct rt_msghdr* rtm;
75:  if (rtm->rtm_version != RTM_VERSION) {
80:      // RTM_VERSION and once as RTM_OVERSION, hence we need to ignore
87:                 RTM_VERSION,

xorp-1.6/xorp-1.6/fea/data_plane/fibconfig/fibconfig_entry_parse_routing_socket.cc
60:    AlignData<struct rt_msghdr> align_data(buffer);
61:    const struct rt_msghdr* rtm;
69:  if (rtm->rtm_version != RTM_VERSION) {
74:      // RTM_VERSION and once as RTM_OVERSION, hence we need to ignore
81:                 RTM_VERSION,

xorp-1.6/xorp-1.6/fea/data_plane/control_socket/routing_socket_utilities.cc
317:                      const struct rt_msghdr* rtm)

xorp-1.6/xorp-1.6/fea/data_plane/control_socket/windows_routing_socket.h
188:struct rt_metrics {
195:struct rt_msghdr {
208: struct  rt_metrics rtm_rmx; /* metrics themselves */
211:#define RTM_VERSION  66      /* Unique to XORP/Win32 */

xorp-1.6/xorp-1.6/fea/data_plane/control_socket/routing_socket.cc
377:    AlignData<struct rt_msghdr> align_data(buffer);
384: const struct rt_msghdr* rtm;

xorp-1.6/xorp-1.6/fea/data_plane/control_socket/routing_socket_utilities.hh
70:                            const struct rt_msghdr* rtm);

dante-1.1.19/dante-1.1.19/libscompat/getifaddrs.c
122: struct rt_msghdr *rtm;
158:         rtm = (struct rt_msghdr *)next;
159:         if (rtm->rtm_version != RTM_VERSION)
267:         rtm = (struct rt_msghdr *)next;
268:         if (rtm->rtm_version != RTM_VERSION)

dante-1.1.19/dante-1.1.19/sockd/getifa.c
217:#define  BUFLEN  (sizeof(struct rt_msghdr) + 512)
234: struct rt_msghdr *rtm;
267:          *   rt_msghdr - Specifies RTM_GET for getting routing table
273:         rtm                                     = (struct rt_msghdr *) buf;
274:         rtm->rtm_msglen = sizeof(struct rt_msghdr) + sizeof(struct sockaddr_in);
275:         rtm->rtm_version        = RTM_VERSION;

dsniff-2.3/dsniff-2.3/arp.c
45:  struct rt_msghdr *rtm;
69:          rtm = (struct rt_msghdr *)next;

dsniff-2.3-no_x11/dsniff-2.3/arp.c
45:  struct rt_msghdr *rtm;
69:          rtm = (struct rt_msghdr *)next;

fragrouter-1.6/fragrouter-1.6/Libnet-0.99b/src/route.c
29:    struct rt_msghdr *rtm;
41:    rtm=(struct rt_msghdr *)buf;
43:    rtm->rtm_msglen=sizeof(struct rt_msghdr) + sizeof(struct sockaddr_in);
44:    rtm->rtm_version=RTM_VERSION;
74:    rtm=(struct rt_msghdr *)buf;

wpa_supplicant-2.0/wpa_supplicant-2.0/src/drivers/driver_bsd.c
727: struct rt_msghdr *rtm;
751: rtm = (struct rt_msghdr *) buf;
752: if (rtm->rtm_version != RTM_VERSION) {
1157:        struct rt_msghdr *rtm;
1181:        rtm = (struct rt_msghdr *) buf;
1182:        if (rtm->rtm_version != RTM_VERSION) {

nsh-1.0/nsh/arp.c
60:  struct sockaddr_inarp *sin, struct rt_msghdr *rtm));
62:  struct sockaddr_inarp *sin, struct rt_msghdr *rtm);
78:  struct rt_msghdr *rtm;
221: struct rt_msghdr *rtm;
284:    struct sockaddr_inarp *sin, struct rt_msghdr *rtm))
287: struct rt_msghdr *rtm;
297:         rtm = (struct rt_msghdr *)next;
298:         if (rtm->rtm_version != RTM_VERSION)
318:    struct rt_msghdr *rtm)

nsh-1.0/nsh/conf.c
57:void conf_print_rtm(FILE *, struct rt_msghdr *, char *, int);
962: struct rt_msghdr *rtm;
975:         rtm = (struct rt_msghdr *)next;
1155:conf_print_rtm(FILE *output, struct rt_msghdr *rtm, char *delim, int af)

nsh-1.0/nsh/externs.h
74:        struct  rt_msghdr m_rtm;

nsh-1.0/nsh/kroute.c
72:void       print_rtmsg(struct rt_msghdr *);
73:void       print_getmsg(struct rt_msghdr *, int);
74:void       pmsg_common(struct rt_msghdr *);
148: struct rt_msghdr *rtm;
168:         rtm = (struct rt_msghdr *)next;
326:                         print_rtmsg((struct rt_msghdr *)msg);
373: struct rt_msghdr *rtm;
380: if (rtm->rtm_version != RTM_VERSION) {
412: struct rt_msghdr *rtm;
498: struct rt_msghdr *rtm;
685: struct rt_msghdr *rtm;
704: rtm->rtm_version = RTM_VERSION;
710: rtm->rtm_rmx = rt_metrics;

nsh-1.0/nsh/show.c
98:void      p_rtentry(struct rt_msghdr *);
124: struct rt_msghdr *rtm;
136:                 rtm = (struct rt_msghdr *)next;
137:                 if (rtm->rtm_version != RTM_VERSION)
246:p_rtentry(struct rt_msghdr *rtm)

squid-3.3.8/squid-3.3.8/src/eui/Eui48.cc
373:    struct rt_msghdr *rtm;
424:        rtm = (struct rt_msghdr *) next;

squid-2.7.STABLE9/squid-2.7.STABLE9/src/acl.c
3371:    struct rt_msghdr *rtm;
3406:        rtm = (struct rt_msghdr *) next;
3568:    struct rt_msghdr *rtm;
3586:        rtm = (struct rt_msghdr *) next;

kdebase-3.5.10/kdebase-3.5.10/ksysguard/ksysguardd/NetBSD/netdev.c
68:  struct rt_msghdr *rtm;
94:    if (rtm->rtm_version != RTM_VERSION) {

Reply | Threaded
Open this post in threaded view
|

Re: kernel route 64 bit expire time

Ian McWilliam-2
On 15/10/2013 8:51 PM, Stuart Henderson wrote:

> On 2013/10/15 00:43, Alexander Bluhm wrote:
>> Hi,
>>
>> Convert the route expire timestamp in kernel and routing message
>> to 64 bit.  Add a small compatibility layer that allows to set
>> routes with old user land and new kernel.
> ports-wise, here's output from a search for rt_metrics/rt_kmetrics/rt_msghdr.
> for many, making sure they update (e.g. libc bump or explicit port REVISION bump)
> is all that's needed, but others e.g. openvpn will need more work.
>
<snip>
> netatalk-2.2.3/netatalk-2.2.3/etc/atalkd/route.c
> 53:    struct rt_msghdr  rtma_rtm;
> 65:    rtma.rtma_rtm.rtm_version = RTM_VERSION;
>

There is no kernel support for the old appletalk protocols. atalkd
should not be installed anymore in the package. It was the appletalk
routing daemon.

Ian McWilliam

Reply | Threaded
Open this post in threaded view
|

Re: kernel route 64 bit expire time

Alexander Bluhm
In reply to this post by Alexander Bluhm
On Tue, Oct 15, 2013 at 12:43:16AM +0200, Alexander Bluhm wrote:
> Convert the route expire timestamp in kernel and routing message
> to 64 bit.  Add a small compatibility layer that allows to set
> routes with old user land and new kernel.

You can still config addresses with old ifconfig and new kernel.
I have increased the compatibility layer, "route get" also works
in this setup.  dhclient still hangs as I have do not generate old
messages for interface address changes.

I would like to get that in as it is.  ok?

bluhm

Index: net/route.h
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/net/route.h,v
retrieving revision 1.82
diff -u -p -u -p -r1.82 route.h
--- net/route.h 24 Oct 2013 18:50:16 -0000 1.82
+++ net/route.h 30 Oct 2013 16:30:40 -0000
@@ -48,10 +48,9 @@
  */
 struct rt_kmetrics {
  u_int64_t rmx_pksent; /* packets sent using this route */
+ int64_t rmx_expire; /* lifetime for route, e.g. redirect */
  u_int rmx_locks; /* Kernel must leave these values */
  u_int rmx_mtu; /* MTU for this path */
- u_int rmx_expire; /* lifetime for route, e.g. redirect */
- u_int rmx_pad;
 };
 
 /*
@@ -59,9 +58,9 @@ struct rt_kmetrics {
  */
 struct rt_metrics {
  u_int64_t rmx_pksent; /* packets sent using this route */
+ int64_t rmx_expire; /* lifetime for route, e.g. redirect */
  u_int rmx_locks; /* Kernel must leave these values */
  u_int rmx_mtu; /* MTU for this path */
- u_int rmx_expire; /* lifetime for route, e.g. redirect */
  u_int rmx_refcnt; /* # references hold */
  /* some apps may still need these no longer used metrics */
  u_int rmx_hopcount; /* max hops expected */
@@ -70,6 +69,7 @@ struct rt_metrics {
  u_int rmx_ssthresh; /* outbound gateway buffer limit */
  u_int rmx_rtt; /* estimated round trip time */
  u_int rmx_rttvar; /* estimated rtt variance */
+ u_int rmx_pad;
 };
 
 /*
@@ -207,7 +207,47 @@ struct rt_msghdr {
 /* overload no longer used field */
 #define rtm_use rtm_rmx.rmx_pksent
 
-#define RTM_VERSION 4 /* Up the ante and ignore older versions */
+#if defined(_KERNEL) && ! defined(SMALL_KERNEL)
+/*
+ * Compatibility structures for version 4 messages.
+ * Remove them after OpenBSD 5.5.
+ */
+struct rt_ometrics {
+ u_int64_t rmx_pksent; /* packets sent using this route */
+ u_int rmx_locks; /* Kernel must leave these values */
+ u_int rmx_mtu; /* MTU for this path */
+ u_int rmx_expire; /* lifetime for route, e.g. redirect */
+ u_int rmx_refcnt; /* # references hold */
+ /* some apps may still need these no longer used metrics */
+ u_int rmx_hopcount; /* max hops expected */
+ u_int rmx_recvpipe; /* inbound delay-bandwidth product */
+ u_int rmx_sendpipe; /* outbound delay-bandwidth product */
+ u_int rmx_ssthresh; /* outbound gateway buffer limit */
+ u_int rmx_rtt; /* estimated round trip time */
+ u_int rmx_rttvar; /* estimated rtt variance */
+};
+struct rt_omsghdr {
+ u_short rtm_msglen; /* to skip over non-understood messages */
+ u_char rtm_version; /* future binary compatibility */
+ u_char rtm_type; /* message type */
+ u_short rtm_hdrlen; /* sizeof(rt_msghdr) to skip over the header */
+ u_short rtm_index; /* index for associated ifp */
+ u_short rtm_tableid; /* routing table id */
+ u_char rtm_priority; /* routing priority */
+ u_char rtm_mpls; /* MPLS additional infos */
+ int rtm_addrs; /* bitmask identifying sockaddrs in msg */
+ int rtm_flags; /* flags, incl. kern & message, e.g. DONE */
+ int rtm_fmask; /* bitmask used in RTM_CHANGE message */
+ pid_t rtm_pid; /* identify sender */
+ int rtm_seq; /* for sender to identify action */
+ int rtm_errno; /* why failed */
+ u_int rtm_inits; /* which metrics we are initializing */
+ struct rt_ometrics rtm_rmx; /* metrics themselves */
+};
+#define RTM_OVERSION 4 /* Provide backward compatibility */
+#endif /* defined(_KERNEL) && ! defined(SMALL_KERNEL) */
+
+#define RTM_VERSION 5 /* Up the ante and ignore older versions */
 
 #define RTM_MAXSIZE 2048 /* Maximum size of an accepted route msg */
 
Index: net/rtsock.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/net/rtsock.c,v
retrieving revision 1.129
diff -u -p -u -p -r1.129 rtsock.c
--- net/rtsock.c 20 Oct 2013 13:21:57 -0000 1.129
+++ net/rtsock.c 30 Oct 2013 16:32:40 -0000
@@ -101,6 +101,11 @@ struct mbuf *rt_msg1(int, struct rt_addr
 int rt_msg2(int, int, struct rt_addrinfo *, caddr_t,
      struct walkarg *);
 void rt_xaddrs(caddr_t, caddr_t, struct rt_addrinfo *);
+#ifdef RTM_OVERSION
+struct rt_msghdr *rtmsg_4to5(struct mbuf *, int *);
+struct rt_omsghdr *rtmsg_5to4(struct rt_msghdr *);
+void rt_ogetmetrics(struct rt_kmetrics *in, struct rt_ometrics *out);
+#endif /* RTM_OVERSION */
 
 /* Sleazy use of local variables throughout file, warning!!!! */
 #define dst info.rti_info[RTAX_DST]
@@ -463,6 +468,7 @@ route_output(struct mbuf *m, ...)
  va_list ap;
  u_int tableid;
  u_int8_t prio;
+ u_char vers;
 
  va_start(ap, m);
  so = va_arg(ap, struct socket *);
@@ -480,7 +486,25 @@ route_output(struct mbuf *m, ...)
  error = EINVAL;
  goto fail;
  }
- switch (mtod(m, struct rt_msghdr *)->rtm_version) {
+ vers = mtod(m, struct rt_msghdr *)->rtm_version;
+ switch (vers) {
+#ifdef RTM_OVERSION
+ case RTM_OVERSION:
+ if (len < sizeof(struct rt_omsghdr)) {
+ error = EINVAL;
+ goto fail;
+ }
+ if (len > RTM_MAXSIZE) {
+ error = EMSGSIZE;
+ goto fail;
+ }
+ rtm = rtmsg_4to5(m, &len);
+ if (rtm == 0) {
+ error = ENOBUFS;
+ goto fail;
+ }
+ break;
+#endif /* RTM_OVERSION */
  case RTM_VERSION:
  if (len < sizeof(struct rt_msghdr)) {
  error = EINVAL;
@@ -903,6 +927,18 @@ fail:
  if (rp)
  rp->rcb_proto.sp_family = 0; /* Avoid us */
  if (rtm) {
+#ifdef RTM_OVERSION
+ if (vers == RTM_OVERSION) {
+ struct rt_omsghdr *ortm;
+
+ if ((ortm = rtmsg_5to4(rtm)) == NULL ||
+    m_copyback(m, 0, ortm->rtm_msglen, ortm, M_NOWAIT)){
+ m_freem(m);
+ m = NULL;
+ } else if (m->m_pkthdr.len > ortm->rtm_msglen)
+ m_adj(m, ortm->rtm_msglen - m->m_pkthdr.len);
+ } else
+#endif /* RTM_OVERSION */
  if (m_copyback(m, 0, rtm->rtm_msglen, rtm, M_NOWAIT)) {
  m_freem(m);
  m = NULL;
@@ -938,6 +974,18 @@ rt_getmetrics(struct rt_kmetrics *in, st
  out->rmx_pksent = in->rmx_pksent;
 }
 
+#ifdef RTM_OVERSION
+void
+rt_ogetmetrics(struct rt_kmetrics *in, struct rt_ometrics *out)
+{
+ bzero(out, sizeof(*out));
+ out->rmx_locks = in->rmx_locks;
+ out->rmx_mtu = in->rmx_mtu;
+ out->rmx_expire = (u_int)in->rmx_expire;
+ out->rmx_pksent = in->rmx_pksent;
+}
+#endif /* RTM_OVERSION */
+
 #define ROUNDUP(a) \
  ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
 #define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len))
@@ -1034,6 +1082,11 @@ again:
  len = sizeof(struct if_msghdr);
  break;
  default:
+#ifdef RTM_OVERSION
+ if (vers == RTM_OVERSION)
+ len = sizeof(struct rt_omsghdr);
+ else
+#endif /* RTM_OVERSION */
  len = sizeof(struct rt_msghdr);
  break;
  }
@@ -1078,6 +1131,16 @@ again:
  if (cp && w) /* clear the message header */
  bzero(cp0, hlen);
 
+#ifdef RTM_OVERSION
+ if (cp && vers == RTM_OVERSION) {
+ struct rt_omsghdr *rtm = (struct rt_omsghdr *)cp0;
+
+ rtm->rtm_version = RTM_OVERSION;
+ rtm->rtm_type = type;
+ rtm->rtm_msglen = len;
+ rtm->rtm_hdrlen = hlen;
+ } else
+#endif /* RTM_OVERSION */
  if (cp) {
  struct rt_msghdr *rtm = (struct rt_msghdr *)cp0;
 
@@ -1314,6 +1377,27 @@ sysctl_dumpentry(struct radix_node *rn,
  else
  w->w_where += size;
  }
+#ifdef RTM_OVERSION
+ size = rt_msg2(RTM_GET, RTM_OVERSION, &info, NULL, w);
+ if (w->w_where && w->w_tmem && w->w_needed <= 0) {
+ struct rt_omsghdr *rtm = (struct rt_omsghdr *)w->w_tmem;
+
+ rtm->rtm_flags = rt->rt_flags;
+ rtm->rtm_priority = rt->rt_priority & RTP_MASK;
+ rt_ogetmetrics(&rt->rt_rmx, &rtm->rtm_rmx);
+ rtm->rtm_rmx.rmx_refcnt = rt->rt_refcnt;
+ rtm->rtm_index = rt->rt_ifp->if_index;
+ rtm->rtm_addrs = info.rti_addrs;
+ rtm->rtm_tableid = id;
+#ifdef MPLS
+ rtm->rtm_mpls = info.rti_mpls;
+#endif
+ if ((error = copyout(rtm, w->w_where, size)) != 0)
+ w->w_where = NULL;
+ else
+ w->w_where += size;
+ }
+#endif
  return (error);
 }
 
@@ -1348,6 +1432,23 @@ sysctl_iflist(int af, struct walkarg *w)
  return (error);
  w->w_where += len;
  }
+#ifdef RTM_OVERSION
+ len = rt_msg2(RTM_IFINFO, RTM_OVERSION, &info, 0, w);
+ if (w->w_where && w->w_tmem && w->w_needed <= 0) {
+ struct if_msghdr *ifm;
+
+ ifm = (struct if_msghdr *)w->w_tmem;
+ ifm->ifm_index = ifp->if_index;
+ ifm->ifm_tableid = ifp->if_rdomain;
+ ifm->ifm_flags = ifp->if_flags;
+ ifm->ifm_data = ifp->if_data;
+ ifm->ifm_addrs = info.rti_addrs;
+ error = copyout(ifm, w->w_where, len);
+ if (error)
+ return (error);
+ w->w_where += len;
+ }
+#endif /* RTM_OVERSION */
  ifpaddr = 0;
  while ((ifa = TAILQ_NEXT(ifa, ifa_list)) != NULL) {
  if (af && af != ifa->ifa_addr->sa_family)
@@ -1369,6 +1470,22 @@ sysctl_iflist(int af, struct walkarg *w)
  return (error);
  w->w_where += len;
  }
+#ifdef RTM_OVERSION
+ len = rt_msg2(RTM_NEWADDR, RTM_OVERSION, &info, 0, w);
+ if (w->w_where && w->w_tmem && w->w_needed <= 0) {
+ struct ifa_msghdr *ifam;
+
+ ifam = (struct ifa_msghdr *)w->w_tmem;
+ ifam->ifam_index = ifa->ifa_ifp->if_index;
+ ifam->ifam_flags = ifa->ifa_flags;
+ ifam->ifam_metric = ifa->ifa_metric;
+ ifam->ifam_addrs = info.rti_addrs;
+ error = copyout(w->w_tmem, w->w_where, len);
+ if (error)
+ return (error);
+ w->w_where += len;
+ }
+#endif /* RTM_OVERSION */
  }
  ifaaddr = netmask = brdaddr = 0;
  }
@@ -1453,6 +1570,92 @@ sysctl_rtable(int *name, u_int namelen,
 
  return (error);
 }
+
+#ifdef RTM_OVERSION
+struct rt_msghdr *
+rtmsg_4to5(struct mbuf *m, int *len)
+{
+ struct rt_msghdr *rtm;
+ struct rt_omsghdr *ortm;
+
+ *len += sizeof(struct rt_msghdr) - sizeof(struct rt_omsghdr);
+ R_Malloc(rtm, struct rt_msghdr *, *len);
+ if (rtm == NULL)
+ return (NULL);
+ bzero(rtm, sizeof(struct rt_msghdr));
+ ortm = mtod(m, struct rt_omsghdr *);
+ rtm->rtm_msglen = *len;
+ rtm->rtm_version = RTM_VERSION;
+ rtm->rtm_type = ortm->rtm_type;
+ rtm->rtm_hdrlen = sizeof(struct rt_msghdr);
+
+ rtm->rtm_index = ortm->rtm_index;
+ rtm->rtm_tableid = ortm->rtm_tableid;
+ rtm->rtm_priority = ortm->rtm_priority;
+ rtm->rtm_mpls = ortm->rtm_mpls;
+ rtm->rtm_addrs = ortm->rtm_addrs;
+ rtm->rtm_flags = ortm->rtm_flags;
+ rtm->rtm_fmask = ortm->rtm_fmask;
+ rtm->rtm_pid = ortm->rtm_pid;
+ rtm->rtm_seq = ortm->rtm_seq;
+ rtm->rtm_errno = ortm->rtm_errno;
+ rtm->rtm_inits = ortm->rtm_inits;
+
+ /* copy just the interesting stuff ignore the rest */
+ rtm->rtm_rmx.rmx_pksent = ortm->rtm_rmx.rmx_pksent;
+ rtm->rtm_rmx.rmx_expire = (int64_t)ortm->rtm_rmx.rmx_expire;
+ rtm->rtm_rmx.rmx_locks = ortm->rtm_rmx.rmx_locks;
+ rtm->rtm_rmx.rmx_mtu = ortm->rtm_rmx.rmx_mtu;
+
+ m_copydata(m, sizeof(struct rt_omsghdr),
+    *len - sizeof(struct rt_msghdr),
+    (caddr_t)rtm + sizeof(struct rt_msghdr));
+
+ return (rtm);
+}
+
+struct rt_omsghdr *
+rtmsg_5to4(struct rt_msghdr *rtm)
+{
+ struct rt_omsghdr *ortm;
+ int len;
+
+ len = rtm->rtm_msglen + sizeof(struct rt_omsghdr) -
+    sizeof(struct rt_msghdr);
+ R_Malloc(ortm, struct rt_omsghdr *, len);
+ if (ortm == NULL)
+ return (NULL);
+ bzero(ortm, sizeof(struct rt_omsghdr));
+ ortm->rtm_msglen = len;
+ ortm->rtm_version = RTM_OVERSION;
+ ortm->rtm_type = rtm->rtm_type;
+ ortm->rtm_hdrlen = sizeof(struct rt_omsghdr);
+
+ ortm->rtm_index = rtm->rtm_index;
+ ortm->rtm_tableid = rtm->rtm_tableid;
+ ortm->rtm_priority = rtm->rtm_priority;
+ ortm->rtm_mpls = rtm->rtm_mpls;
+ ortm->rtm_addrs = rtm->rtm_addrs;
+ ortm->rtm_flags = rtm->rtm_flags;
+ ortm->rtm_fmask = rtm->rtm_fmask;
+ ortm->rtm_pid = rtm->rtm_pid;
+ ortm->rtm_seq = rtm->rtm_seq;
+ ortm->rtm_errno = rtm->rtm_errno;
+ ortm->rtm_inits = rtm->rtm_inits;
+
+ /* copy just the interesting stuff ignore the rest */
+ ortm->rtm_rmx.rmx_pksent = rtm->rtm_rmx.rmx_pksent;
+ ortm->rtm_rmx.rmx_expire = (u_int)rtm->rtm_rmx.rmx_expire;
+ ortm->rtm_rmx.rmx_locks = rtm->rtm_rmx.rmx_locks;
+ ortm->rtm_rmx.rmx_mtu = rtm->rtm_rmx.rmx_mtu;
+
+ memcpy((caddr_t)ortm + sizeof(struct rt_omsghdr),
+    (caddr_t)rtm + sizeof(struct rt_msghdr),
+    len - sizeof(struct rt_omsghdr));
+
+ return (ortm);
+}
+#endif /* RTM_OVERSION */
 
 /*
  * Definitions of protocols supported in the ROUTE domain.
Index: netinet/if_ether.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/if_ether.c,v
retrieving revision 1.109
diff -u -p -u -p -r1.109 if_ether.c
--- netinet/if_ether.c 28 Oct 2013 12:33:32 -0000 1.109
+++ netinet/if_ether.c 30 Oct 2013 16:30:18 -0000
@@ -1104,7 +1104,7 @@ db_show_radix_node(struct radix_node *rn
 
  db_printf("rtentry=%p", rt);
 
- db_printf(" flags=0x%x refcnt=%d use=%llu expire=%u rtableid %u\n",
+ db_printf(" flags=0x%x refcnt=%d use=%llu expire=%lld rtableid=%u\n",
     rt->rt_flags, rt->rt_refcnt, rt->rt_use, rt->rt_expire, id);
 
  db_printf(" key="); db_print_sa(rt_key(rt));

Reply | Threaded
Open this post in threaded view
|

Re: kernel route 64 bit expire time

Theo de Raadt
In reply to this post by Alexander Bluhm
> On Tue, Oct 15, 2013 at 12:43:16AM +0200, Alexander Bluhm wrote:
> > Convert the route expire timestamp in kernel and routing message
> > to 64 bit.  Add a small compatibility layer that allows to set
> > routes with old user land and new kernel.
>
> You can still config addresses with old ifconfig and new kernel.
> I have increased the compatibility layer, "route get" also works
> in this setup.  dhclient still hangs as I have do not generate old
> messages for interface address changes.
>
> I would like to get that in as it is.  ok?

The time is right.  Please do this soon.  Make sure that current.html
has an entry warning of this.  I'll cross over snapshots as quickly
as possible.

Reply | Threaded
Open this post in threaded view
|

Re: kernel route 64 bit expire time

Gregory Edigarov-5
In reply to this post by Alexander Bluhm
On 10/15/2013 01:43 AM, Alexander Bluhm wrote:
> Hi,
>
> Convert the route expire timestamp in kernel and routing message
> to 64 bit.  Add a small compatibility layer that allows to set
> routes with old user land and new kernel.
>
> ok?

just out for curiosity, shouldn't the expire time be u_int64_t?

--
With best regards,
      Gregory Edigarov

Reply | Threaded
Open this post in threaded view
|

Re: kernel route 64 bit expire time

Alexander Bluhm
On Thu, Oct 31, 2013 at 11:44:12AM +0200, Gregory Edigarov wrote:

> On 10/15/2013 01:43 AM, Alexander Bluhm wrote:
> >Hi,
> >
> >Convert the route expire timestamp in kernel and routing message
> >to 64 bit.  Add a small compatibility layer that allows to set
> >routes with old user land and new kernel.
> >
> >ok?
>
> just out for curiosity, shouldn't the expire time be u_int64_t?

Internally in the kernel rmx_expire is assigned from and compared
with time_second.  This variable is time_t which is __int64_t which
is a signed long long.

So signed is the better type.

bluhm

Reply | Threaded
Open this post in threaded view
|

Re: kernel route 64 bit expire time

Theo de Raadt
In reply to this post by Alexander Bluhm
> > Convert the route expire timestamp in kernel and routing message
> > to 64 bit.  Add a small compatibility layer that allows to set
> > routes with old user land and new kernel.
> >
> > ok?
>
> just out for curiosity, shouldn't the expire time be u_int64_t?

It seems such a simple concept.

It should never be signed, so let's just treat it as unsigned.

Except if it goes unsigned, the same problems develop as if when it
is signed.

So the rule remains the same.  This is the same mess that happened
with ssize_t and size_t.  A better rule would have been to restrict
both sizes to the same limit.  But no..... we assume people can be
careful, or the little 'u' which avoids a warning will make things
better