From be23faf1df4792d439bc3b1978c2905fe3883de3 Mon Sep 17 00:00:00 2001 From: Jeffrey Hsu Date: Fri, 4 Mar 2005 03:48:25 +0000 Subject: [PATCH] Cosmetic changes only. --- sys/netinet/if_ether.c | 11 ++------ sys/netinet/in_gif.c | 23 +++++++--------- sys/netinet/in_hostcache.c | 4 +-- sys/netinet/in_pcb.c | 25 ++++++++--------- sys/netinet/in_rmx.c | 13 ++++----- sys/netinet/ip_flow.c | 56 ++++++++++++++++---------------------- sys/netinet/ip_input.c | 4 +-- sys/netinet/raw_ip.c | 18 ++++++------ sys/netinet/tcp_input.c | 10 +++---- sys/netinet6/icmp6.c | 3 +- sys/netinet6/in6_gif.c | 9 +++--- sys/netinet6/in6_rmx.c | 18 ++++++------ 12 files changed, 84 insertions(+), 110 deletions(-) diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c index a40f8cc5ff..9dbe661f8e 100644 --- a/sys/netinet/if_ether.c +++ b/sys/netinet/if_ether.c @@ -82,7 +82,7 @@ * * @(#)if_ether.c 8.1 (Berkeley) 6/10/93 * $FreeBSD: src/sys/netinet/if_ether.c,v 1.64.2.23 2003/04/11 07:23:15 fjoe Exp $ - * $DragonFly: src/sys/netinet/if_ether.c,v 1.25 2005/01/23 06:41:55 hsu Exp $ + * $DragonFly: src/sys/netinet/if_ether.c,v 1.26 2005/03/04 03:48:25 hsu Exp $ */ /* @@ -209,7 +209,6 @@ arp_rtrequest(int req, struct rtentry *rt, struct rt_addrinfo *info) struct sockaddr_dl null_sdl = { sizeof null_sdl, AF_LINK }; static boolean_t arpinit_done; - static int arp_inuse, arp_allocated; /* for debugging only */ if (!arpinit_done) { arpinit_done = TRUE; @@ -268,7 +267,6 @@ arp_rtrequest(int req, struct rtentry *rt, struct rt_addrinfo *info) log(LOG_DEBUG, "arp_rtrequest: malloc failed\n"); break; } - arp_inuse++, arp_allocated++; bzero(la, sizeof *la); la->la_rt = rt; rt->rt_flags |= RTF_LLINFO; @@ -320,7 +318,6 @@ arp_rtrequest(int req, struct rtentry *rt, struct rt_addrinfo *info) case RTM_DELETE: if (la == NULL) break; - arp_inuse--; LIST_REMOVE(la, la_le); rt->rt_llinfo = NULL; rt->rt_flags &= ~RTF_LLINFO; @@ -811,19 +808,18 @@ reply: m_freem(m); return; } + --rt->rt_refcnt; /* * Don't send proxies for nodes on the same interface * as this one came out of, or we'll get into a fight * over who claims what Ether address. */ if (rt->rt_ifp == ifp) { - --rt->rt_refcnt; m_freem(m); return; } memcpy(ar_tha(ah), ar_sha(ah), ah->ar_hln); memcpy(ar_sha(ah), IF_LLADDR(ifp), ah->ar_hln); - --rt->rt_refcnt; #ifdef DEBUG_PROXY printf("arp: proxying for %s\n", inet_ntoa(itaddr)); #endif @@ -845,7 +841,6 @@ reply: arh->arc_dhost = *ar_tha(ah); arh->arc_type = ARCTYPE_ARP; break; - case IFT_ISO88025: /* Re-arrange the source/dest address */ memcpy(th->iso88025_dhost, th->iso88025_shost, @@ -946,7 +941,7 @@ arplookup(in_addr_t addr, boolean_t create, boolean_t proxy) if (rt->rt_refcnt <= 0 && (rt->rt_flags & RTF_WASCLONED)) { /* No references to this route. Purge it. */ rtrequest(RTM_DELETE, rt_key(rt), rt->rt_gateway, - rt_mask(rt), rt->rt_flags, NULL); + rt_mask(rt), rt->rt_flags, NULL); } return (NULL); } diff --git a/sys/netinet/in_gif.c b/sys/netinet/in_gif.c index 14f9fa74d1..8e70b284e5 100644 --- a/sys/netinet/in_gif.c +++ b/sys/netinet/in_gif.c @@ -1,6 +1,6 @@ /* * $FreeBSD: src/sys/netinet/in_gif.c,v 1.5.2.11 2003/01/23 21:06:45 sam Exp $ - * $DragonFly: src/sys/netinet/in_gif.c,v 1.14 2005/02/22 02:52:48 joerg Exp $ + * $DragonFly: src/sys/netinet/in_gif.c,v 1.15 2005/03/04 03:48:25 hsu Exp $ * $KAME: in_gif.c,v 1.54 2001/05/14 14:02:16 itojun Exp $ */ /* @@ -121,7 +121,7 @@ in_gif_output(struct ifnet *ifp, int family, struct mbuf *m) tos = ip->ip_tos; break; } -#endif /* INET */ +#endif #ifdef INET6 case AF_INET6: { @@ -136,7 +136,7 @@ in_gif_output(struct ifnet *ifp, int family, struct mbuf *m) tos = (ntohl(ip6->ip6_flow) >> 20) & 0xff; break; } -#endif /* INET6 */ +#endif default: #ifdef DEBUG printf("in_gif_output: warning: unknown family %d passed\n", @@ -180,7 +180,7 @@ in_gif_output(struct ifnet *ifp, int family, struct mbuf *m) dst->sin_family = sin_dst->sin_family; dst->sin_len = sizeof(struct sockaddr_in); dst->sin_addr = sin_dst->sin_addr; - if (sc->gif_ro.ro_rt) { + if (sc->gif_ro.ro_rt != NULL) { RTFREE(sc->gif_ro.ro_rt); sc->gif_ro.ro_rt = NULL; } @@ -314,17 +314,15 @@ gif_validate4(const struct ip *ip, struct gif_softc *sc, struct ifnet *ifp) return 0; } /* reject packets with broadcast on source */ - for (ia4 = TAILQ_FIRST(&in_ifaddrhead); ia4; - ia4 = TAILQ_NEXT(ia4, ia_link)) - { - if ((ia4->ia_ifa.ifa_ifp->if_flags & IFF_BROADCAST) == 0) + TAILQ_FOREACH(ia4, &in_ifaddrhead, ia_link) { + if (!(ia4->ia_ifa.ifa_ifp->if_flags & IFF_BROADCAST)) continue; if (ip->ip_src.s_addr == ia4->ia_broadaddr.sin_addr.s_addr) return 0; } /* ingress filters on outer source */ - if ((sc->gif_if.if_flags & IFF_LINK2) == 0 && ifp) { + if (!(sc->gif_if.if_flags & IFF_LINK2) && ifp != NULL) { struct sockaddr_in sin; struct rtentry *rt; @@ -333,17 +331,16 @@ gif_validate4(const struct ip *ip, struct gif_softc *sc, struct ifnet *ifp) sin.sin_len = sizeof(struct sockaddr_in); sin.sin_addr = ip->ip_src; rt = rtpurelookup((struct sockaddr *)&sin); - if (!rt || rt->rt_ifp != ifp) { + if (rt != NULL) + --rt->rt_refcnt; + if (rt == NULL || rt->rt_ifp != ifp) { #if 0 log(LOG_WARNING, "%s: packet from 0x%x dropped " "due to ingress filter\n", if_name(&sc->gif_if), (u_int32_t)ntohl(sin.sin_addr.s_addr)); #endif - if (rt) - --rt->rt_refcnt; return 0; } - --rt->rt_refcnt; } return 32 * 2; diff --git a/sys/netinet/in_hostcache.c b/sys/netinet/in_hostcache.c index f4005ea220..f91b034756 100644 --- a/sys/netinet/in_hostcache.c +++ b/sys/netinet/in_hostcache.c @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netinet/in_hostcache.c,v 1.3 1999/08/28 00:49:16 peter Exp $ - * $DragonFly: src/sys/netinet/Attic/in_hostcache.c,v 1.5 2005/01/06 17:59:32 hsu Exp $ + * $DragonFly: src/sys/netinet/Attic/in_hostcache.c,v 1.6 2005/03/04 03:48:25 hsu Exp $ */ #include @@ -76,7 +76,7 @@ inhc_alloc(struct sockaddr_in *sin) return inhc; rt = rtlookup(inhc->inhc_hc.hc_host); - if (rt == 0) + if (rt == NULL) return 0; MALLOC(inhc, struct in_hcentry *, sizeof *inhc, M_HOSTCACHE, M_WAITOK); diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 56f4511f0a..5b380e1d10 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004 Jeffrey M. Hsu. All rights reserved. + * cOPyright (c) 2004 Jeffrey M. Hsu. All rights reserved. * Copyright (c) 2004 The DragonFly Project. All rights reserved. * * This code is derived from software contributed to The DragonFly Project @@ -82,7 +82,7 @@ * * @(#)in_pcb.c 8.4 (Berkeley) 5/24/95 * $FreeBSD: src/sys/netinet/in_pcb.c,v 1.59.2.27 2004/01/02 04:06:42 ambrisko Exp $ - * $DragonFly: src/sys/netinet/in_pcb.c,v 1.33 2005/02/08 22:56:19 hsu Exp $ + * $DragonFly: src/sys/netinet/in_pcb.c,v 1.34 2005/03/04 03:48:25 hsu Exp $ */ #include "opt_ipsec.h" @@ -785,21 +785,20 @@ in_pcbpurgeif0(head, ifp) * (by a redirect), time to try a default gateway again. */ void -in_losing(inp) - struct inpcb *inp; +in_losing(struct inpcb *inp) { struct rtentry *rt; - struct rt_addrinfo info; + struct rt_addrinfo rtinfo; if ((rt = inp->inp_route.ro_rt)) { - bzero(&info, sizeof info); - info.rti_flags = rt->rt_flags; - info.rti_info[RTAX_DST] = rt_key(rt); - info.rti_info[RTAX_GATEWAY] = rt->rt_gateway; - info.rti_info[RTAX_NETMASK] = rt_mask(rt); - rt_missmsg(RTM_LOSING, &info, rt->rt_flags, 0); + bzero(&rtinfo, sizeof(struct rt_addrinfo)); + rtinfo.rti_info[RTAX_DST] = rt_key(rt); + rtinfo.rti_info[RTAX_GATEWAY] = rt->rt_gateway; + rtinfo.rti_info[RTAX_NETMASK] = rt_mask(rt); + rtinfo.rti_flags = rt->rt_flags; + rt_missmsg(RTM_LOSING, &rtinfo, rt->rt_flags, 0); if (rt->rt_flags & RTF_DYNAMIC) - rtrequest1(RTM_DELETE, &info, NULL); + rtrequest1(RTM_DELETE, &rtinfo, NULL); inp->inp_route.ro_rt = NULL; rtfree(rt); /* @@ -820,7 +819,7 @@ in_rtchange(inp, errno) { if (inp->inp_route.ro_rt) { rtfree(inp->inp_route.ro_rt); - inp->inp_route.ro_rt = 0; + inp->inp_route.ro_rt = NULL; /* * A new route can be allocated the next time * output is attempted. diff --git a/sys/netinet/in_rmx.c b/sys/netinet/in_rmx.c index 685226cf39..8f428451bc 100644 --- a/sys/netinet/in_rmx.c +++ b/sys/netinet/in_rmx.c @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netinet/in_rmx.c,v 1.37.2.3 2002/08/09 14:49:23 ru Exp $ - * $DragonFly: src/sys/netinet/in_rmx.c,v 1.9 2005/01/06 17:59:32 hsu Exp $ + * $DragonFly: src/sys/netinet/in_rmx.c,v 1.10 2005/03/04 03:48:25 hsu Exp $ */ /* @@ -121,7 +121,7 @@ in_addroute(char *key, char *mask, struct radix_node_head *head, * ARP entry and delete it if so. */ rt2 = rtpurelookup((struct sockaddr *)sin); - if (rt2) { + if (rt2 != NULL) { --rt->rt_refcnt; if (rt2->rt_flags & RTF_LLINFO && rt2->rt_flags & RTF_HOST && @@ -247,11 +247,10 @@ in_rtqkill(struct radix_node *rn, void *rock) err = rtrequest(RTM_DELETE, rt_key(rt), rt->rt_gateway, rt_mask(rt), rt->rt_flags, NULL); - if (err) { + if (err) log(LOG_WARNING, "in_rtqkill: error %d\n", err); - } else { + else ap->killed++; - } } else { if (ap->updating && (rt->rt_rmx.rmx_expire - time_second > @@ -360,7 +359,6 @@ in_inithead(void **head, int off) return 1; } - /* * This zaps old routes when the interface goes down or interface * address is deleted. In the latter case, it deletes static routes @@ -396,9 +394,8 @@ in_ifadownkill(struct radix_node *rn, void *xap) rt->rt_flags &= ~(RTF_CLONING | RTF_PRCLONING); err = rtrequest(RTM_DELETE, rt_key(rt), rt->rt_gateway, rt_mask(rt), rt->rt_flags, NULL); - if (err) { + if (err) log(LOG_WARNING, "in_ifadownkill: error %d\n", err); - } } return 0; } diff --git a/sys/netinet/ip_flow.c b/sys/netinet/ip_flow.c index ad6c15c989..86fbab2ca1 100644 --- a/sys/netinet/ip_flow.c +++ b/sys/netinet/ip_flow.c @@ -34,7 +34,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/netinet/ip_flow.c,v 1.9.2.2 2001/11/04 17:35:31 luigi Exp $ - * $DragonFly: src/sys/netinet/ip_flow.c,v 1.6 2005/01/06 09:14:13 hsu Exp $ + * $DragonFly: src/sys/netinet/ip_flow.c,v 1.7 2005/03/04 03:48:25 hsu Exp $ */ #include @@ -73,21 +73,18 @@ SYSCTL_INT(_net_inet_ip, IPCTL_FASTFORWARDING, fastforwarding, CTLFLAG_RW, static MALLOC_DEFINE(M_IPFLOW, "ip_flow", "IP flow"); static unsigned -ipflow_hash( - struct in_addr dst, - struct in_addr src, - unsigned tos) +ipflow_hash(struct in_addr dst, struct in_addr src, unsigned tos) { unsigned hash = tos; int idx; + for (idx = 0; idx < 32; idx += IPFLOW_HASHBITS) hash += (dst.s_addr >> (32 - idx)) + (src.s_addr >> idx); return hash & (IPFLOW_HASHSIZE-1); } static struct ipflow * -ipflow_lookup( - const struct ip *ip) +ipflow_lookup(const struct ip *ip) { unsigned hash; struct ipflow *ipf; @@ -96,9 +93,9 @@ ipflow_lookup( ipf = LIST_FIRST(&ipflows[hash]); while (ipf != NULL) { - if (ip->ip_dst.s_addr == ipf->ipf_dst.s_addr - && ip->ip_src.s_addr == ipf->ipf_src.s_addr - && ip->ip_tos == ipf->ipf_tos) + if (ip->ip_dst.s_addr == ipf->ipf_dst.s_addr && + ip->ip_src.s_addr == ipf->ipf_src.s_addr && + ip->ip_tos == ipf->ipf_tos) break; ipf = LIST_NEXT(ipf, ipf_next); } @@ -106,8 +103,7 @@ ipflow_lookup( } int -ipflow_fastforward( - struct mbuf *m) +ipflow_fastforward(struct mbuf *m) { struct ip *ip; struct ipflow *ipf; @@ -124,8 +120,8 @@ ipflow_fastforward( * IP header with no option and valid version and length */ ip = mtod(m, struct ip *); - if (ip->ip_v != IPVERSION || ip->ip_hl != (sizeof(struct ip) >> 2) - || ntohs(ip->ip_len) > m->m_pkthdr.len) + if (ip->ip_v != IPVERSION || ip->ip_hl != (sizeof(struct ip) >> 2) || + ntohs(ip->ip_len) > m->m_pkthdr.len) return 0; /* * Find a flow. @@ -151,11 +147,10 @@ ipflow_fastforward( * Modify the TTL and incrementally change the checksum. */ ip->ip_ttl -= IPTTLDEC; - if (ip->ip_sum >= htons(0xffff - (IPTTLDEC << 8))) { + if (ip->ip_sum >= htons(0xffff - (IPTTLDEC << 8))) ip->ip_sum += htons(IPTTLDEC << 8) + 1; - } else { + else ip->ip_sum += htons(IPTTLDEC << 8); - } /* * Send the packet on its way. All we can get back is ENOBUFS @@ -175,10 +170,9 @@ ipflow_fastforward( } return 1; } - + static void -ipflow_addstats( - struct ipflow *ipf) +ipflow_addstats(struct ipflow *ipf) { ipf->ipf_ro.ro_rt->rt_use += ipf->ipf_uses; ipstat.ips_cantforward += ipf->ipf_errors + ipf->ipf_dropped; @@ -187,8 +181,7 @@ ipflow_addstats( } static void -ipflow_free( - struct ipflow *ipf) +ipflow_free(struct ipflow *ipf) { int s; @@ -207,8 +200,7 @@ ipflow_free( } static struct ipflow * -ipflow_reap( - void) +ipflow_reap(void) { struct ipflow *ipf, *maybe_ipf = NULL; int idx; @@ -228,18 +220,17 @@ ipflow_reap( * or has had the least uses in the last 1.5 * intervals. */ - if (maybe_ipf == NULL - || ipf->ipf_timer < maybe_ipf->ipf_timer - || (ipf->ipf_timer == maybe_ipf->ipf_timer - && ipf->ipf_last_uses + ipf->ipf_uses < - maybe_ipf->ipf_last_uses + - maybe_ipf->ipf_uses)) + if (maybe_ipf == NULL || + ipf->ipf_timer < maybe_ipf->ipf_timer || + (ipf->ipf_timer == maybe_ipf->ipf_timer && + ipf->ipf_last_uses + ipf->ipf_uses < + maybe_ipf->ipf_last_uses + maybe_ipf->ipf_uses)) maybe_ipf = ipf; ipf = LIST_NEXT(ipf, ipf_next); } } ipf = maybe_ipf; - done: +done: /* * Remove the entry from the flow table. */ @@ -252,8 +243,7 @@ ipflow_reap( } void -ipflow_slowtimo( - void) +ipflow_slowtimo(void) { struct ipflow *ipf; int idx; diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index b72f8b1404..f804e7ef82 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -82,7 +82,7 @@ * * @(#)ip_input.c 8.2 (Berkeley) 1/4/94 * $FreeBSD: src/sys/netinet/ip_input.c,v 1.130.2.52 2003/03/07 07:01:28 silby Exp $ - * $DragonFly: src/sys/netinet/ip_input.c,v 1.46 2005/02/11 22:25:57 joerg Exp $ + * $DragonFly: src/sys/netinet/ip_input.c,v 1.47 2005/03/04 03:48:25 hsu Exp $ */ #define _IP_VHL @@ -1878,7 +1878,7 @@ ip_forward(struct mbuf *m, int using_srcrt, struct sockaddr_in *next_hop) struct ifnet dummyifp; #endif - dest = 0; + dest = INADDR_ANY; /* * Cache the destination address of the packet; this may be * changed by use of 'ipfw fwd'. diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c index 283da6e146..c637f9872d 100644 --- a/sys/netinet/raw_ip.c +++ b/sys/netinet/raw_ip.c @@ -32,7 +32,7 @@ * * @(#)raw_ip.c 8.7 (Berkeley) 5/15/95 * $FreeBSD: src/sys/netinet/raw_ip.c,v 1.64.2.16 2003/08/24 08:24:38 hsu Exp $ - * $DragonFly: src/sys/netinet/raw_ip.c,v 1.20 2005/02/08 22:56:19 hsu Exp $ + * $DragonFly: src/sys/netinet/raw_ip.c,v 1.21 2005/03/04 03:48:25 hsu Exp $ */ #include "opt_inet6.h" @@ -288,10 +288,10 @@ rip_output(struct mbuf *m, struct socket *so, ...) ip = mtod(m, struct ip *); /* don't allow both user specified and setsockopt options, and don't allow packet length sizes that will crash */ - if (((IP_VHL_HL(ip->ip_vhl) != (sizeof (*ip) >> 2)) - && inp->inp_options) - || (ip->ip_len > m->m_pkthdr.len) - || (ip->ip_len < (IP_VHL_HL(ip->ip_vhl) << 2))) { + if (((IP_VHL_HL(ip->ip_vhl) != (sizeof (*ip) >> 2)) && + inp->inp_options) || + (ip->ip_len > m->m_pkthdr.len) || + (ip->ip_len < (IP_VHL_HL(ip->ip_vhl) << 2))) { m_freem(m); return EINVAL; } @@ -460,8 +460,8 @@ rip_ctlinput(int cmd, struct sockaddr *sa, void *vip) switch (cmd) { case PRC_IFDOWN: TAILQ_FOREACH(ia, &in_ifaddrhead, ia_link) { - if (ia->ia_ifa.ifa_addr == sa - && (ia->ia_flags & IFA_ROUTE)) { + if (ia->ia_ifa.ifa_addr == sa && + (ia->ia_flags & IFA_ROUTE)) { /* * in_ifscrub kills the interface route. */ @@ -488,8 +488,8 @@ rip_ctlinput(int cmd, struct sockaddr *sa, void *vip) flags = RTF_UP; ifp = ia->ia_ifa.ifa_ifp; - if ((ifp->if_flags & IFF_LOOPBACK) - || (ifp->if_flags & IFF_POINTOPOINT)) + if ((ifp->if_flags & IFF_LOOPBACK) || + (ifp->if_flags & IFF_POINTOPOINT)) flags |= RTF_HOST; err = rtinit(&ia->ia_ifa, RTM_ADD, flags); diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index f9bf77b505..37e5cb9e8e 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -82,7 +82,7 @@ * * @(#)tcp_input.c 8.12 (Berkeley) 5/24/95 * $FreeBSD: src/sys/netinet/tcp_input.c,v 1.107.2.38 2003/05/21 04:46:41 cjc Exp $ - * $DragonFly: src/sys/netinet/tcp_input.c,v 1.52 2005/02/08 22:56:19 hsu Exp $ + * $DragonFly: src/sys/netinet/tcp_input.c,v 1.53 2005/03/04 03:48:25 hsu Exp $ */ #include "opt_ipfw.h" /* for ipfw_fwd */ @@ -1142,7 +1142,7 @@ after_listen: tp->snd_cwnd >= tp->snd_wnd && !IN_FASTRECOVERY(tp)) { /* - * this is a pure ack for outstanding data. + * This is a pure ack for outstanding data. */ ++tcpstat.tcps_predack; /* @@ -1223,9 +1223,8 @@ after_listen: callout_reset(tp->tt_rexmt, tp->t_rxtcur, tcp_timer_rexmt, tp); - sowwakeup(so); - if (so->so_snd.sb_cc) + if (so->so_snd.sb_cc > 0) tcp_output(tp); return; } @@ -1234,7 +1233,7 @@ after_listen: LIST_EMPTY(&tp->t_segq) && tlen <= sbspace(&so->so_rcv)) { /* - * this is a pure, in-sequence data packet + * This is a pure, in-sequence data packet * with nothing on the reassembly queue and * we have enough buffer space to take it. */ @@ -1253,7 +1252,6 @@ after_listen: sbappendstream(&so->so_rcv, m); } sorwakeup(so); - /* * This code is responsible for most of the ACKs * the TCP stack sends back after receiving a data diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c index 2c49f9735b..0f61aa0db9 100644 --- a/sys/netinet6/icmp6.c +++ b/sys/netinet6/icmp6.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netinet6/icmp6.c,v 1.6.2.13 2003/05/06 06:46:58 suz Exp $ */ -/* $DragonFly: src/sys/netinet6/icmp6.c,v 1.19 2005/03/04 02:54:31 hsu Exp $ */ +/* $DragonFly: src/sys/netinet6/icmp6.c,v 1.20 2005/03/04 03:48:25 hsu Exp $ */ /* $KAME: icmp6.c,v 1.211 2001/04/04 05:56:20 itojun Exp $ */ /* @@ -1135,7 +1135,6 @@ icmp6_mtudisc_update(struct ip6ctlparam *ip6cp, int validated) } /* sin6.sin6_scope_id = XXX: should be set if DST is a scoped addr */ rt = rtpurelookup((struct sockaddr *)&sin6); - if (rt != NULL && (rt->rt_flags & RTF_HOST) && !(rt->rt_rmx.rmx_locks & RTV_MTU)) { if (mtu < IPV6_MMTU) { /* XXX */ diff --git a/sys/netinet6/in6_gif.c b/sys/netinet6/in6_gif.c index fb056f1e18..c57024f943 100644 --- a/sys/netinet6/in6_gif.c +++ b/sys/netinet6/in6_gif.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netinet6/in6_gif.c,v 1.2.2.7 2003/01/23 21:06:47 sam Exp $ */ -/* $DragonFly: src/sys/netinet6/in6_gif.c,v 1.13 2005/02/22 02:52:48 joerg Exp $ */ +/* $DragonFly: src/sys/netinet6/in6_gif.c,v 1.14 2005/03/04 03:48:25 hsu Exp $ */ /* $KAME: in6_gif.c,v 1.49 2001/05/14 14:02:17 itojun Exp $ */ /* @@ -183,7 +183,7 @@ in6_gif_output(struct ifnet *ifp, dst->sin6_family = sin6_dst->sin6_family; dst->sin6_len = sizeof(struct sockaddr_in6); dst->sin6_addr = sin6_dst->sin6_addr; - if (sc->gif_ro6.ro_rt) { + if (sc->gif_ro6.ro_rt != NULL) { RTFREE(sc->gif_ro6.ro_rt); sc->gif_ro6.ro_rt = NULL; } @@ -327,17 +327,16 @@ gif_validate6(const struct ip6_hdr *ip6, struct gif_softc *sc, sin6.sin6_scope_id = 0; /* XXX */ rt = rtpurelookup((struct sockaddr *)&sin6); + if (rt != NULL) + --rt->rt_refcnt; if (rt == NULL || rt->rt_ifp != ifp) { #if 0 log(LOG_WARNING, "%s: packet from %s dropped " "due to ingress filter\n", if_name(&sc->gif_if), ip6_sprintf(&sin6.sin6_addr)); #endif - if (rt != NULL) - --rt->rt_refcnt; return 0; } - --rt->rt_refcnt; } return 128 * 2; diff --git a/sys/netinet6/in6_rmx.c b/sys/netinet6/in6_rmx.c index b0adf002e3..64986e63d2 100644 --- a/sys/netinet6/in6_rmx.c +++ b/sys/netinet6/in6_rmx.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netinet6/in6_rmx.c,v 1.1.2.4 2004/10/06 02:35:17 suz Exp $ */ -/* $DragonFly: src/sys/netinet6/in6_rmx.c,v 1.11 2005/01/06 17:59:32 hsu Exp $ */ +/* $DragonFly: src/sys/netinet6/in6_rmx.c,v 1.12 2005/03/04 03:48:25 hsu Exp $ */ /* $KAME: in6_rmx.c,v 1.11 2001/07/26 06:53:16 jinmei Exp $ */ /* @@ -311,17 +311,16 @@ in6_rtqkill(struct radix_node *rn, void *rock) err = rtrequest(RTM_DELETE, rt_key(rt), rt->rt_gateway, rt_mask(rt), rt->rt_flags, NULL); - if (err) { + if (err) log(LOG_WARNING, "in6_rtqkill: error %d", err); - } else { + else ap->killed++; - } } else { - if (ap->updating - && (rt->rt_rmx.rmx_expire - time_second - > rtq_reallyold)) { - rt->rt_rmx.rmx_expire = time_second - + rtq_reallyold; + if (ap->updating && + (rt->rt_rmx.rmx_expire - time_second > + rtq_reallyold)) { + rt->rt_rmx.rmx_expire = + time_second + rtq_reallyold; } ap->nextstop = lmin(ap->nextstop, rt->rt_rmx.rmx_expire); @@ -446,6 +445,7 @@ in6_rtqdrain(void) struct radix_node_head *rnh = rt_tables[AF_INET6]; struct rtqk_arg arg; int s; + arg.found = arg.killed = 0; arg.rnh = rnh; arg.nextstop = 0; -- 2.41.0