+in_pcbnotify(head, dst, errno, notify)
+ struct inpcb *head;
+ register struct in_addr *dst;
+ int errno, (*notify)();
+{
+ register struct inpcb *inp, *oinp;
+ int s = splimp();
+
+ for (inp = head->inp_next; inp != head;) {
+ if (inp->inp_faddr.s_addr != dst->s_addr ||
+ inp->inp_socket == 0) {
+ inp = inp->inp_next;
+ continue;
+ }
+ if (errno)
+ inp->inp_socket->so_error = errno;
+ oinp = inp;
+ inp = inp->inp_next;
+ if (notify)
+ (*notify)(oinp);
+ }
+ splx(s);
+}
+
+/*
+ * Check for alternatives when higher level complains
+ * about service problems. For now, invalidate cached
+ * routing information. If the route was created dynamically
+ * (by a redirect), time to try a default gateway again.
+ */
+in_losing(inp)
+ struct inpcb *inp;
+{
+ register struct rtentry *rt;
+
+ if ((rt = inp->inp_route.ro_rt)) {
+ if (rt->rt_flags & RTF_DYNAMIC)
+ (void) rtrequest((int)SIOCDELRT, rt);
+ rtfree(rt);
+ inp->inp_route.ro_rt = 0;
+ /*
+ * A new route can be allocated
+ * the next time output is attempted.
+ */
+ }
+}
+
+/*
+ * After a routing change, flush old routing
+ * and allocate a (hopefully) better one.
+ */
+in_rtchange(inp)
+ register struct inpcb *inp;
+{
+ if (inp->inp_route.ro_rt) {
+ rtfree(inp->inp_route.ro_rt);
+ inp->inp_route.ro_rt = 0;
+ /*
+ * A new route can be allocated the next time
+ * output is attempted.
+ */
+ }
+}
+