Re: A bit of a route socket bug...
From: Matthew Luckie (mjl_at_luckie.org.nz)
Date: 07/08/05
- Previous message: Hernán Freschi: "Re: pppoe+radius server"
- In reply to: gnn_at_freebsd.org: "A bit of a route socket bug..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 8 Jul 2005 12:22:06 +1200 To: gnn@freebsd.org
I'm not very familiar with the route code, but here is what i came up with.
[mjl@rayon mjl]$ sudo route change 10.3.2.1 127.0.0.1
route: writing to routing socket: No such process
change host 10.3.2.1: gateway 127.0.0.1: not in table
the code checks that if changing a host or network route, that the
route returned by a lookup matches this type. for network routes, it
also ensures that the netmask matches.
--- rtsock.c.orig Fri Jul 8 11:56:36 2005
+++ rtsock.c Fri Jul 8 12:12:39 2005
@@ -489,6 +489,30 @@
case RTM_CHANGE:
/*
+ * Check that the route returned is exactly the one
+ * that was looked up, so that some other route is not
+ * changed in error.
+ * Ensure the type of route (host/net) to be changed
+ * matches, and ensure that the route matches if net
+ * by checking that the netmask matches.
+ */
+ if (rt->rt_flags & RTF_HOST) {
+ if((info.rti_flags & RTF_HOST) == 0) {
+ RT_UNLOCK(rt);
+ senderr(ESRCH);
+ }
+ } else {
+ if((info.rti_flags & RTF_HOST) ||
+ info.rti_info[RTAX_NETMASK] == NULL ||
+ rt_mask(rt) == NULL ||
+ !sa_equal(info.rti_info[RTAX_NETMASK],
+ rt_mask(rt))) {
+ RT_UNLOCK(rt);
+ senderr(ESRCH);
+ }
+ }
+
+ /*
* New gateway could require new ifaddr, ifp;
* flags may also be different; ifp may be specified
* by ll sockaddr when protocol address is ambiguous
_______________________________________________
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"
- Previous message: Hernán Freschi: "Re: pppoe+radius server"
- In reply to: gnn_at_freebsd.org: "A bit of a route socket bug..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]