icmp6.c (b2630c29344385f13f1ab2a973158c9a5afd71d4) | icmp6.c (1272577e22d8f1c1c5b5e88f2624836e93aecb17) |
---|---|
1/* $FreeBSD$ */ 2/* $KAME: icmp6.c,v 1.211 2001/04/04 05:56:20 itojun Exp $ */ 3 4/*- 5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 117 unchanged lines hidden (view full) --- 126static int ni6_addrs __P((struct icmp6_nodeinfo *, struct mbuf *, 127 struct ifnet **, struct in6_addr *)); 128static int ni6_store_addrs __P((struct icmp6_nodeinfo *, struct icmp6_nodeinfo *, 129 struct ifnet *, int)); 130static int icmp6_notify_error __P((struct mbuf **, int, int, int)); 131 132 133void | 1/* $FreeBSD$ */ 2/* $KAME: icmp6.c,v 1.211 2001/04/04 05:56:20 itojun Exp $ */ 3 4/*- 5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 117 unchanged lines hidden (view full) --- 126static int ni6_addrs __P((struct icmp6_nodeinfo *, struct mbuf *, 127 struct ifnet **, struct in6_addr *)); 128static int ni6_store_addrs __P((struct icmp6_nodeinfo *, struct icmp6_nodeinfo *, 129 struct ifnet *, int)); 130static int icmp6_notify_error __P((struct mbuf **, int, int, int)); 131 132 133void |
134icmp6_init() | 134icmp6_init(void) |
135{ | 135{ |
136 |
|
136 mld6_init(); 137} 138 139static void | 137 mld6_init(); 138} 139 140static void |
140icmp6_errcount(stat, type, code) 141 struct icmp6errstat *stat; 142 int type, code; | 141icmp6_errcount(struct icmp6errstat *stat, int type, int code) |
143{ 144 switch (type) { 145 case ICMP6_DST_UNREACH: 146 switch (code) { 147 case ICMP6_DST_UNREACH_NOROUTE: 148 stat->icp6errs_dst_unreach_noroute++; 149 return; 150 case ICMP6_DST_UNREACH_ADMIN: --- 43 unchanged lines hidden (view full) --- 194 stat->icp6errs_unknown++; 195} 196 197/* 198 * A wrapper function for icmp6_error() necessary when the erroneous packet 199 * may not contain enough scope zone information. 200 */ 201void | 142{ 143 switch (type) { 144 case ICMP6_DST_UNREACH: 145 switch (code) { 146 case ICMP6_DST_UNREACH_NOROUTE: 147 stat->icp6errs_dst_unreach_noroute++; 148 return; 149 case ICMP6_DST_UNREACH_ADMIN: --- 43 unchanged lines hidden (view full) --- 193 stat->icp6errs_unknown++; 194} 195 196/* 197 * A wrapper function for icmp6_error() necessary when the erroneous packet 198 * may not contain enough scope zone information. 199 */ 200void |
202icmp6_error2(m, type, code, param, ifp) 203 struct mbuf *m; 204 int type, code, param; 205 struct ifnet *ifp; | 201icmp6_error2(struct mbuf *m, int type, int code, int param, 202 struct ifnet *ifp) |
206{ 207 struct ip6_hdr *ip6; 208 209 if (ifp == NULL) 210 return; 211 212#ifndef PULLDOWN_TEST 213 IP6_EXTHDR_CHECK(m, 0, sizeof(struct ip6_hdr), ); --- 14 unchanged lines hidden (view full) --- 228 229 icmp6_error(m, type, code, param); 230} 231 232/* 233 * Generate an error packet of type error in response to bad IP6 packet. 234 */ 235void | 203{ 204 struct ip6_hdr *ip6; 205 206 if (ifp == NULL) 207 return; 208 209#ifndef PULLDOWN_TEST 210 IP6_EXTHDR_CHECK(m, 0, sizeof(struct ip6_hdr), ); --- 14 unchanged lines hidden (view full) --- 225 226 icmp6_error(m, type, code, param); 227} 228 229/* 230 * Generate an error packet of type error in response to bad IP6 packet. 231 */ 232void |
236icmp6_error(m, type, code, param) 237 struct mbuf *m; 238 int type, code, param; | 233icmp6_error(struct mbuf *m, int type, int code, int param) |
239{ 240 struct ip6_hdr *oip6, *nip6; 241 struct icmp6_hdr *icmp6; 242 u_int preplen; 243 int off; 244 int nxt; 245 246 icmp6stat.icp6s_error++; --- 137 unchanged lines hidden (view full) --- 384 */ 385 m_freem(m); 386} 387 388/* 389 * Process a received ICMP6 message. 390 */ 391int | 234{ 235 struct ip6_hdr *oip6, *nip6; 236 struct icmp6_hdr *icmp6; 237 u_int preplen; 238 int off; 239 int nxt; 240 241 icmp6stat.icp6s_error++; --- 137 unchanged lines hidden (view full) --- 379 */ 380 m_freem(m); 381} 382 383/* 384 * Process a received ICMP6 message. 385 */ 386int |
392icmp6_input(mp, offp, proto) 393 struct mbuf **mp; 394 int *offp, proto; | 387icmp6_input(struct mbuf **mp, int *offp, int proto) |
395{ 396 struct mbuf *m = *mp, *n; 397 struct ip6_hdr *ip6, *nip6; 398 struct icmp6_hdr *icmp6, *nicmp6; 399 int off = *offp; 400 int icmp6len = m->m_pkthdr.len - *offp; 401 int code, sum, noff; 402 char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN]; --- 454 unchanged lines hidden (view full) --- 857 return IPPROTO_DONE; 858 859 freeit: 860 m_freem(m); 861 return IPPROTO_DONE; 862} 863 864static int | 388{ 389 struct mbuf *m = *mp, *n; 390 struct ip6_hdr *ip6, *nip6; 391 struct icmp6_hdr *icmp6, *nicmp6; 392 int off = *offp; 393 int icmp6len = m->m_pkthdr.len - *offp; 394 int code, sum, noff; 395 char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN]; --- 454 unchanged lines hidden (view full) --- 850 return IPPROTO_DONE; 851 852 freeit: 853 m_freem(m); 854 return IPPROTO_DONE; 855} 856 857static int |
865icmp6_notify_error(mp, off, icmp6len, code) 866 struct mbuf **mp; 867 int off, icmp6len, code; | 858icmp6_notify_error(struct mbuf **mp, int off, int icmp6len, int code) |
868{ 869 struct mbuf *m = *mp; 870 struct icmp6_hdr *icmp6; 871 struct ip6_hdr *eip6; 872 u_int32_t notifymtu; 873 struct sockaddr_in6 icmp6src, icmp6dst; 874 875 if (icmp6len < sizeof(struct icmp6_hdr) + sizeof(struct ip6_hdr)) { --- 214 unchanged lines hidden (view full) --- 1090 return (0); 1091 1092 freeit: 1093 m_freem(m); 1094 return (-1); 1095} 1096 1097void | 859{ 860 struct mbuf *m = *mp; 861 struct icmp6_hdr *icmp6; 862 struct ip6_hdr *eip6; 863 u_int32_t notifymtu; 864 struct sockaddr_in6 icmp6src, icmp6dst; 865 866 if (icmp6len < sizeof(struct icmp6_hdr) + sizeof(struct ip6_hdr)) { --- 214 unchanged lines hidden (view full) --- 1081 return (0); 1082 1083 freeit: 1084 m_freem(m); 1085 return (-1); 1086} 1087 1088void |
1098icmp6_mtudisc_update(ip6cp, validated) 1099 struct ip6ctlparam *ip6cp; 1100 int validated; | 1089icmp6_mtudisc_update(struct ip6ctlparam *ip6cp, int validated) |
1101{ 1102 struct in6_addr *dst = ip6cp->ip6c_finaldst; 1103 struct icmp6_hdr *icmp6 = ip6cp->ip6c_icmp6; 1104 struct mbuf *m = ip6cp->ip6c_m; /* will be necessary for scope issue */ 1105 u_int mtu = ntohl(icmp6->icmp6_mtu); 1106 struct in_conninfo inc; 1107 1108#if 0 --- 39 unchanged lines hidden (view full) --- 1148 * - IPv6 Subject address handling 1149 * - IPv4 Subject address handling support missing 1150 * - Proxy reply (answer even if it's not for me) 1151 * - joins NI group address at in6_ifattach() time only, does not cope 1152 * with hostname changes by sethostname(3) 1153 */ 1154#define hostnamelen strlen(hostname) 1155static struct mbuf * | 1090{ 1091 struct in6_addr *dst = ip6cp->ip6c_finaldst; 1092 struct icmp6_hdr *icmp6 = ip6cp->ip6c_icmp6; 1093 struct mbuf *m = ip6cp->ip6c_m; /* will be necessary for scope issue */ 1094 u_int mtu = ntohl(icmp6->icmp6_mtu); 1095 struct in_conninfo inc; 1096 1097#if 0 --- 39 unchanged lines hidden (view full) --- 1137 * - IPv6 Subject address handling 1138 * - IPv4 Subject address handling support missing 1139 * - Proxy reply (answer even if it's not for me) 1140 * - joins NI group address at in6_ifattach() time only, does not cope 1141 * with hostname changes by sethostname(3) 1142 */ 1143#define hostnamelen strlen(hostname) 1144static struct mbuf * |
1156ni6_input(m, off) 1157 struct mbuf *m; 1158 int off; | 1145ni6_input(struct mbuf *m, int off) |
1159{ 1160 struct icmp6_nodeinfo *ni6, *nni6; 1161 struct mbuf *n = NULL; 1162 u_int16_t qtype; 1163 int subjlen; 1164 int replylen = sizeof(struct ip6_hdr) + sizeof(struct icmp6_nodeinfo); 1165 struct ni_reply_fqdn *fqdn; 1166 int addrs; /* for NI_QTYPE_NODEADDR */ --- 302 unchanged lines hidden (view full) --- 1469} 1470#undef hostnamelen 1471 1472/* 1473 * make a mbuf with DNS-encoded string. no compression support. 1474 * 1475 * XXX names with less than 2 dots (like "foo" or "foo.section") will be 1476 * treated as truncated name (two \0 at the end). this is a wild guess. | 1146{ 1147 struct icmp6_nodeinfo *ni6, *nni6; 1148 struct mbuf *n = NULL; 1149 u_int16_t qtype; 1150 int subjlen; 1151 int replylen = sizeof(struct ip6_hdr) + sizeof(struct icmp6_nodeinfo); 1152 struct ni_reply_fqdn *fqdn; 1153 int addrs; /* for NI_QTYPE_NODEADDR */ --- 302 unchanged lines hidden (view full) --- 1456} 1457#undef hostnamelen 1458 1459/* 1460 * make a mbuf with DNS-encoded string. no compression support. 1461 * 1462 * XXX names with less than 2 dots (like "foo" or "foo.section") will be 1463 * treated as truncated name (two \0 at the end). this is a wild guess. |
1464 * 1465 * old - return pascal string if non-zero |
|
1477 */ 1478static struct mbuf * | 1466 */ 1467static struct mbuf * |
1479ni6_nametodns(name, namelen, old) 1480 const char *name; 1481 int namelen; 1482 int old; /* return pascal string if non-zero */ | 1468ni6_nametodns(const char *name, int namelen, int old) |
1483{ 1484 struct mbuf *m; 1485 char *cp, *ep; 1486 const char *p, *q; 1487 int i, len, nterm; 1488 1489 if (old) 1490 len = namelen + 1; --- 80 unchanged lines hidden (view full) --- 1571} 1572 1573/* 1574 * check if two DNS-encoded string matches. takes care of truncated 1575 * form (with \0\0 at the end). no compression support. 1576 * XXX upper/lowercase match (see RFC2065) 1577 */ 1578static int | 1469{ 1470 struct mbuf *m; 1471 char *cp, *ep; 1472 const char *p, *q; 1473 int i, len, nterm; 1474 1475 if (old) 1476 len = namelen + 1; --- 80 unchanged lines hidden (view full) --- 1557} 1558 1559/* 1560 * check if two DNS-encoded string matches. takes care of truncated 1561 * form (with \0\0 at the end). no compression support. 1562 * XXX upper/lowercase match (see RFC2065) 1563 */ 1564static int |
1579ni6_dnsmatch(a, alen, b, blen) 1580 const char *a; 1581 int alen; 1582 const char *b; 1583 int blen; | 1565ni6_dnsmatch(const char *a, int alen, const char *b, int blen) |
1584{ 1585 const char *a0, *b0; 1586 int l; 1587 1588 /* simplest case - need validation? */ 1589 if (alen == blen && bcmp(a, b, alen) == 0) 1590 return 1; 1591 --- 43 unchanged lines hidden (view full) --- 1635 else 1636 return 0; 1637} 1638 1639/* 1640 * calculate the number of addresses to be returned in the node info reply. 1641 */ 1642static int | 1566{ 1567 const char *a0, *b0; 1568 int l; 1569 1570 /* simplest case - need validation? */ 1571 if (alen == blen && bcmp(a, b, alen) == 0) 1572 return 1; 1573 --- 43 unchanged lines hidden (view full) --- 1617 else 1618 return 0; 1619} 1620 1621/* 1622 * calculate the number of addresses to be returned in the node info reply. 1623 */ 1624static int |
1643ni6_addrs(ni6, m, ifpp, subj) 1644 struct icmp6_nodeinfo *ni6; 1645 struct mbuf *m; 1646 struct ifnet **ifpp; 1647 struct in6_addr *subj; | 1625ni6_addrs(struct icmp6_nodeinfo *ni6, struct mbuf *m, struct ifnet **ifpp, 1626 struct in6_addr *subj) |
1648{ 1649 struct ifnet *ifp; 1650 struct in6_ifaddr *ifa6; 1651 struct ifaddr *ifa; 1652 int addrs = 0, addrsofif, iffound = 0; 1653 int niflags = ni6->ni_flags; 1654 1655 if ((niflags & NI_NODEADDR_FLAG_ALL) == 0) { --- 73 unchanged lines hidden (view full) --- 1729 addrs += addrsofif; 1730 } 1731 IFNET_RUNLOCK(); 1732 1733 return (addrs); 1734} 1735 1736static int | 1627{ 1628 struct ifnet *ifp; 1629 struct in6_ifaddr *ifa6; 1630 struct ifaddr *ifa; 1631 int addrs = 0, addrsofif, iffound = 0; 1632 int niflags = ni6->ni_flags; 1633 1634 if ((niflags & NI_NODEADDR_FLAG_ALL) == 0) { --- 73 unchanged lines hidden (view full) --- 1708 addrs += addrsofif; 1709 } 1710 IFNET_RUNLOCK(); 1711 1712 return (addrs); 1713} 1714 1715static int |
1737ni6_store_addrs(ni6, nni6, ifp0, resid) 1738 struct icmp6_nodeinfo *ni6, *nni6; 1739 struct ifnet *ifp0; 1740 int resid; | 1716ni6_store_addrs(struct icmp6_nodeinfo *ni6, struct icmp6_nodeinfo *nni6, 1717 struct ifnet *ifp0, int resid) |
1741{ 1742 struct ifnet *ifp = ifp0 ? ifp0 : TAILQ_FIRST(&ifnet); 1743 struct in6_ifaddr *ifa6; 1744 struct ifaddr *ifa; 1745 struct ifnet *ifp_dep = NULL; 1746 int copied = 0, allow_deprecated = 0; 1747 u_char *cp = (u_char *)(nni6 + 1); 1748 int niflags = ni6->ni_flags; --- 122 unchanged lines hidden (view full) --- 1871 1872 return (copied); 1873} 1874 1875/* 1876 * XXX almost dup'ed code with rip6_input. 1877 */ 1878static int | 1718{ 1719 struct ifnet *ifp = ifp0 ? ifp0 : TAILQ_FIRST(&ifnet); 1720 struct in6_ifaddr *ifa6; 1721 struct ifaddr *ifa; 1722 struct ifnet *ifp_dep = NULL; 1723 int copied = 0, allow_deprecated = 0; 1724 u_char *cp = (u_char *)(nni6 + 1); 1725 int niflags = ni6->ni_flags; --- 122 unchanged lines hidden (view full) --- 1848 1849 return (copied); 1850} 1851 1852/* 1853 * XXX almost dup'ed code with rip6_input. 1854 */ 1855static int |
1879icmp6_rip6_input(mp, off) 1880 struct mbuf **mp; 1881 int off; | 1856icmp6_rip6_input(struct mbuf **mp, int off) |
1882{ 1883 struct mbuf *m = *mp; 1884 struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *); 1885 struct in6pcb *in6p; 1886 struct in6pcb *last = NULL; 1887 struct sockaddr_in6 fromsa; 1888 struct icmp6_hdr *icmp6; 1889 struct mbuf *opts = NULL; --- 145 unchanged lines hidden (view full) --- 2035 return IPPROTO_DONE; 2036} 2037 2038/* 2039 * Reflect the ip6 packet back to the source. 2040 * OFF points to the icmp6 header, counted from the top of the mbuf. 2041 */ 2042void | 1857{ 1858 struct mbuf *m = *mp; 1859 struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *); 1860 struct in6pcb *in6p; 1861 struct in6pcb *last = NULL; 1862 struct sockaddr_in6 fromsa; 1863 struct icmp6_hdr *icmp6; 1864 struct mbuf *opts = NULL; --- 145 unchanged lines hidden (view full) --- 2010 return IPPROTO_DONE; 2011} 2012 2013/* 2014 * Reflect the ip6 packet back to the source. 2015 * OFF points to the icmp6 header, counted from the top of the mbuf. 2016 */ 2017void |
2043icmp6_reflect(m, off) 2044 struct mbuf *m; 2045 size_t off; | 2018icmp6_reflect(struct mbuf *m, size_t off) |
2046{ 2047 struct ip6_hdr *ip6; 2048 struct icmp6_hdr *icmp6; 2049 struct in6_ifaddr *ia; 2050 int plen; 2051 int type, code; 2052 struct ifnet *outif = NULL; 2053 struct in6_addr origdst, *src = NULL; --- 141 unchanged lines hidden (view full) --- 2195 return; 2196 2197 bad: 2198 m_freem(m); 2199 return; 2200} 2201 2202void | 2019{ 2020 struct ip6_hdr *ip6; 2021 struct icmp6_hdr *icmp6; 2022 struct in6_ifaddr *ia; 2023 int plen; 2024 int type, code; 2025 struct ifnet *outif = NULL; 2026 struct in6_addr origdst, *src = NULL; --- 141 unchanged lines hidden (view full) --- 2168 return; 2169 2170 bad: 2171 m_freem(m); 2172 return; 2173} 2174 2175void |
2203icmp6_fasttimo() | 2176icmp6_fasttimo(void) |
2204{ 2205 2206 return; 2207} 2208 2209static const char * | 2177{ 2178 2179 return; 2180} 2181 2182static const char * |
2210icmp6_redirect_diag(src6, dst6, tgt6) 2211 struct in6_addr *src6; 2212 struct in6_addr *dst6; 2213 struct in6_addr *tgt6; | 2183icmp6_redirect_diag(struct in6_addr *src6, struct in6_addr *dst6, 2184 struct in6_addr *tgt6) |
2214{ 2215 static char buf[1024]; 2216 char ip6bufs[INET6_ADDRSTRLEN]; 2217 char ip6bufd[INET6_ADDRSTRLEN]; 2218 char ip6buft[INET6_ADDRSTRLEN]; 2219 snprintf(buf, sizeof(buf), "(src=%s dst=%s tgt=%s)", 2220 ip6_sprintf(ip6bufs, src6), ip6_sprintf(ip6bufd, dst6), 2221 ip6_sprintf(ip6buft, tgt6)); 2222 return buf; 2223} 2224 2225void | 2185{ 2186 static char buf[1024]; 2187 char ip6bufs[INET6_ADDRSTRLEN]; 2188 char ip6bufd[INET6_ADDRSTRLEN]; 2189 char ip6buft[INET6_ADDRSTRLEN]; 2190 snprintf(buf, sizeof(buf), "(src=%s dst=%s tgt=%s)", 2191 ip6_sprintf(ip6bufs, src6), ip6_sprintf(ip6bufd, dst6), 2192 ip6_sprintf(ip6buft, tgt6)); 2193 return buf; 2194} 2195 2196void |
2226icmp6_redirect_input(m, off) 2227 struct mbuf *m; 2228 int off; | 2197icmp6_redirect_input(struct mbuf *m, int off) |
2229{ 2230 struct ifnet *ifp; 2231 struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *); 2232 struct nd_redirect *nd_rd; 2233 int icmp6len = ntohs(ip6->ip6_plen); 2234 char *lladdr = NULL; 2235 int lladdrlen = 0; 2236 u_char *redirhdr = NULL; --- 190 unchanged lines hidden (view full) --- 2427 return; 2428 2429 bad: 2430 icmp6stat.icp6s_badredirect++; 2431 m_freem(m); 2432} 2433 2434void | 2198{ 2199 struct ifnet *ifp; 2200 struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *); 2201 struct nd_redirect *nd_rd; 2202 int icmp6len = ntohs(ip6->ip6_plen); 2203 char *lladdr = NULL; 2204 int lladdrlen = 0; 2205 u_char *redirhdr = NULL; --- 190 unchanged lines hidden (view full) --- 2396 return; 2397 2398 bad: 2399 icmp6stat.icp6s_badredirect++; 2400 m_freem(m); 2401} 2402 2403void |
2435icmp6_redirect_output(m0, rt) 2436 struct mbuf *m0; 2437 struct rtentry *rt; | 2404icmp6_redirect_output(struct mbuf *m0, struct rtentry *rt) |
2438{ 2439 struct ifnet *ifp; /* my outgoing interface */ 2440 struct in6_addr *ifp_ll6; 2441 struct in6_addr *router_ll6; 2442 struct ip6_hdr *sip6; /* m0 as struct ip6_hdr */ 2443 struct mbuf *m = NULL; /* newly allocated one */ 2444 struct ip6_hdr *ip6; /* m as struct ip6_hdr */ 2445 struct nd_redirect *nd_rd; --- 267 unchanged lines hidden (view full) --- 2713 if (m0) 2714 m_freem(m0); 2715} 2716 2717/* 2718 * ICMPv6 socket option processing. 2719 */ 2720int | 2405{ 2406 struct ifnet *ifp; /* my outgoing interface */ 2407 struct in6_addr *ifp_ll6; 2408 struct in6_addr *router_ll6; 2409 struct ip6_hdr *sip6; /* m0 as struct ip6_hdr */ 2410 struct mbuf *m = NULL; /* newly allocated one */ 2411 struct ip6_hdr *ip6; /* m as struct ip6_hdr */ 2412 struct nd_redirect *nd_rd; --- 267 unchanged lines hidden (view full) --- 2680 if (m0) 2681 m_freem(m0); 2682} 2683 2684/* 2685 * ICMPv6 socket option processing. 2686 */ 2687int |
2721icmp6_ctloutput(so, sopt) 2722 struct socket *so; 2723 struct sockopt *sopt; | 2688icmp6_ctloutput(struct socket *so, struct sockopt *sopt) |
2724{ 2725 int error = 0; 2726 int optlen; 2727 struct inpcb *inp = sotoinpcb(so); 2728 int level, op, optname; 2729 2730 if (sopt) { 2731 level = sopt->sopt_level; --- 58 unchanged lines hidden (view full) --- 2790 2791/* 2792 * Perform rate limit check. 2793 * Returns 0 if it is okay to send the icmp6 packet. 2794 * Returns 1 if the router SHOULD NOT send this icmp6 packet due to rate 2795 * limitation. 2796 * 2797 * XXX per-destination/type check necessary? | 2689{ 2690 int error = 0; 2691 int optlen; 2692 struct inpcb *inp = sotoinpcb(so); 2693 int level, op, optname; 2694 2695 if (sopt) { 2696 level = sopt->sopt_level; --- 58 unchanged lines hidden (view full) --- 2755 2756/* 2757 * Perform rate limit check. 2758 * Returns 0 if it is okay to send the icmp6 packet. 2759 * Returns 1 if the router SHOULD NOT send this icmp6 packet due to rate 2760 * limitation. 2761 * 2762 * XXX per-destination/type check necessary? |
2763 * 2764 * dst - not used at this moment 2765 * type - not used at this moment 2766 * code - not used at this moment |
|
2798 */ 2799static int | 2767 */ 2768static int |
2800icmp6_ratelimit(dst, type, code) 2801 const struct in6_addr *dst; /* not used at this moment */ 2802 const int type; /* not used at this moment */ 2803 const int code; /* not used at this moment */ | 2769icmp6_ratelimit(const struct in6_addr *dst, const int type, 2770 const int code) |
2804{ 2805 int ret; 2806 2807 ret = 0; /* okay to send */ 2808 2809 /* PPS limit */ 2810 if (!ppsratecheck(&icmp6errppslim_last, &icmp6errpps_count, 2811 icmp6errppslim)) { 2812 /* The packet is subject to rate limit */ 2813 ret++; 2814 } 2815 2816 return ret; 2817} | 2771{ 2772 int ret; 2773 2774 ret = 0; /* okay to send */ 2775 2776 /* PPS limit */ 2777 if (!ppsratecheck(&icmp6errppslim_last, &icmp6errpps_count, 2778 icmp6errppslim)) { 2779 /* The packet is subject to rate limit */ 2780 ret++; 2781 } 2782 2783 return ret; 2784} |