FreeBSD Bugzilla – Attachment 170079 Details for
Bug 144343
The rtadvd cannot avoid the prefix that doesn't want to advertise.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
patch for 10-STABLE (r292068)
patch-10-r292068-rtadvd_ignore_prefix.diff (text/plain), 5.01 KB, created by
Tatsuki Makino
on 2016-05-07 06:18:13 UTC
(
hide
)
Description:
patch for 10-STABLE (r292068)
Filename:
MIME Type:
Creator:
Tatsuki Makino
Created:
2016-05-07 06:18:13 UTC
Size:
5.01 KB
patch
obsolete
>Index: usr.sbin/rtadvd/config.c >=================================================================== >--- usr.sbin/rtadvd/config.c (revision 292068) >+++ usr.sbin/rtadvd/config.c (working copy) >@@ -280,6 +280,7 @@ > rm_rainfo(struct rainfo *rai) > { > struct prefix *pfx; >+ struct ignore_prefix *ipfx; > struct soliciter *sol; > struct rdnss *rdn; > struct rdnss_addr *rdna; >@@ -298,6 +299,10 @@ > > while ((pfx = TAILQ_FIRST(&rai->rai_prefix)) != NULL) > delete_prefix(pfx); >+ while ((ipfx = TAILQ_FIRST(&rai->rai_ignore_prefix)) != NULL) { >+ TAILQ_REMOVE(&rai->rai_ignore_prefix, ipfx, ipfx_next); >+ free(ipfx); >+ } > while ((sol = TAILQ_FIRST(&rai->rai_soliciter)) != NULL) { > TAILQ_REMOVE(&rai->rai_soliciter, sol, sol_next); > free(sol); >@@ -359,6 +364,7 @@ > > ELM_MALLOC(rai, exit(1)); > TAILQ_INIT(&rai->rai_prefix); >+ TAILQ_INIT(&rai->rai_ignore_prefix); > TAILQ_INIT(&rai->rai_route); > TAILQ_INIT(&rai->rai_rdnss); > TAILQ_INIT(&rai->rai_dnssl); >@@ -491,6 +497,45 @@ > MAYHAVE(val, "clockskew", 0); > rai->rai_clockskew = val; > >+ /* list of prefixes not advertised */ >+ rai->rai_ignore_pfxs = 0; >+ for (i = -1; i < MAXPREFIX; i++) { >+ struct ignore_prefix *ipfx; >+ >+ makeentry(entbuf, sizeof(entbuf), i, "ignoreaddr"); >+ addr = (char *)agetstr(entbuf, &bp); >+ if (addr == NULL) >+ continue; >+ >+ /* allocate memory to store prefix information */ >+ ELM_MALLOC(ipfx, exit(1)); >+ ipfx->ipfx_rainfo = rai; >+ >+ if (inet_pton(AF_INET6, addr, &ipfx->ipfx_prefix) != 1) { >+ syslog(LOG_ERR, >+ "<%s> inet_pton failed for %s", >+ __func__, addr); >+ goto getconfig_free_ignore_pfx; >+ } >+ >+ makeentry(entbuf, sizeof(entbuf), i, "ignoreplen"); >+ MAYHAVE(val, entbuf, 64); >+ if (val < 0 || val > 128) { >+ syslog(LOG_ERR, "<%s> prefixlen (%" PRIu32 ") for %s " >+ "on %s out of range", >+ __func__, val, addr, ifi->ifi_ifname); >+ goto getconfig_free_ignore_pfx; >+ } >+ ipfx->ipfx_prefixlen = (int)val; >+ >+ /* link into chain */ >+ TAILQ_INSERT_TAIL(&rai->rai_ignore_prefix, ipfx, ipfx_next); >+ rai->rai_ignore_pfxs++; >+ continue; >+getconfig_free_ignore_pfx: >+ free(ipfx); >+ } >+ > rai->rai_pfxs = 0; > for (i = -1; i < MAXPREFIX; i++) { > struct prefix *pfx; >@@ -1046,6 +1091,16 @@ > } > if (plen == 128) /* XXX */ > continue; >+ if (find_ignore_prefix(rai, a, plen) != NULL) { >+ /* ignore a prefix configured to be ignored. */ >+ syslog(LOG_DEBUG, "<%s> new prefix (%s/%d) " >+ "is configured to be ignored on %s", >+ __func__, >+ inet_ntop(AF_INET6, a, >+ (char *)ntopbuf, sizeof(ntopbuf)), >+ plen, ifi->ifi_ifname); >+ continue; >+ } > if (find_prefix(rai, a, plen)) { > /* ignore a duplicated prefix. */ > continue; >Index: usr.sbin/rtadvd/rtadvd.c >=================================================================== >--- usr.sbin/rtadvd/rtadvd.c (revision 292068) >+++ usr.sbin/rtadvd/rtadvd.c (working copy) >@@ -605,6 +605,16 @@ > __func__, plen); > break; > } >+ /* prefix configured to be ignored */ >+ if (find_ignore_prefix(rai, addr, plen) != NULL) { >+ syslog(LOG_DEBUG, "<%s> new prefix (%s/%d) " >+ "is configured to be ignored on %s", >+ __func__, >+ inet_ntop(AF_INET6, addr, >+ (char *)addrbuf, sizeof(addrbuf)), >+ plen, ifi->ifi_ifname); >+ break; >+ } > pfx = find_prefix(rai, addr, plen); > if (pfx) { > if (pfx->pfx_timer) { >@@ -1402,6 +1412,23 @@ > return (0); > } > >+struct ignore_prefix * >+find_ignore_prefix(struct rainfo *rai, struct in6_addr *prefix, int plen) >+{ >+ struct ignore_prefix *ipfx; >+ int bytelen, bitlen; >+ char bitmask; >+ >+ TAILQ_FOREACH(ipfx, &rai->rai_ignore_prefix, ipfx_next) { >+ if (prefix_match(prefix, plen, >+ &ipfx->ipfx_prefix, ipfx->ipfx_prefixlen)) { >+ return ipfx; >+ } >+ } >+ >+ return (NULL); >+} >+ > static int > nd6_options(struct nd_opt_hdr *hdr, int limit, > union nd_opt *ndopts, uint32_t optflags) >Index: usr.sbin/rtadvd/rtadvd.h >=================================================================== >--- usr.sbin/rtadvd/rtadvd.h (revision 292068) >+++ usr.sbin/rtadvd/rtadvd.h (working copy) >@@ -178,6 +178,13 @@ > struct sockaddr_in6 sol_addr; > }; > >+struct ignore_prefix { >+ TAILQ_ENTRY(ignore_prefix) ipfx_next; >+ struct rainfo *ipfx_rainfo; /* back pointer to the interface */ >+ int ipfx_prefixlen; >+ struct in6_addr ipfx_prefix; >+}; >+ > struct rainfo { > /* pointer for list */ > TAILQ_ENTRY(rainfo) rai_next; >@@ -204,6 +211,10 @@ > TAILQ_HEAD(, prefix) rai_prefix;/* AdvPrefixList(link head) */ > int rai_pfxs; /* number of prefixes */ > >+ /* list of prefixes not advertised */ >+ TAILQ_HEAD(, ignore_prefix) rai_ignore_prefix; /* prefix list */ >+ int rai_ignore_pfxs; /* number of prefixes */ >+ > uint16_t rai_clockskew; /* used for consisitency check of lifetimes */ > > TAILQ_HEAD(, rdnss) rai_rdnss; /* DNS server list */ >@@ -294,5 +305,7 @@ > struct ifinfo *if_indextoifinfo(int); > struct prefix *find_prefix(struct rainfo *, > struct in6_addr *, int); >+struct ignore_prefix *find_ignore_prefix(struct rainfo *, >+ struct in6_addr *, int); > void rtadvd_set_reload(int); > void rtadvd_set_shutdown(int);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 144343
:
104201
|
104202
|
104203
|
155714
|
155715
|
170079
|
193803