Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F157899579
D56130.id174454.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D56130.id174454.diff
View Options
diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c
--- a/sys/netinet6/nd6_rtr.c
+++ b/sys/netinet6/nd6_rtr.c
@@ -1497,6 +1497,45 @@
pfxlist_onlink_check();
}
+static void
+nd6_prefix_update(struct nd_prefixctl *new, struct nd_prefix *pr)
+{
+ int error;
+ char ip6buf[INET6_ADDRSTRLEN];
+
+ /*
+ * Update prefix information. Note that the on-link (L) bit
+ * and the autonomous (A) bit should NOT be changed from 1
+ * to 0.
+ */
+ if (new->ndpr_raf_onlink == 1)
+ pr->ndpr_raf_onlink = 1;
+ if (new->ndpr_raf_auto == 1)
+ pr->ndpr_raf_auto = 1;
+ if (new->ndpr_raf_onlink != 0) {
+ pr->ndpr_vltime = new->ndpr_vltime;
+ pr->ndpr_pltime = new->ndpr_pltime;
+ in6_init_prefix_ltimes(pr);
+ pr->ndpr_lastupdate = time_uptime;
+ }
+
+ if (new->ndpr_raf_onlink != 0 &&
+ (pr->ndpr_stateflags & NDPRF_ONLINK) == 0) {
+ ND6_ONLINK_LOCK();
+ if ((error = nd6_prefix_onlink(pr)) != 0) {
+ nd6log((LOG_ERR,
+ "%s: failed to make the prefix %s/%d "
+ "on-link on %s (errno=%d)\n", __func__,
+ ip6_sprintf(ip6buf,
+ &pr->ndpr_prefix.sin6_addr),
+ pr->ndpr_plen, if_name(pr->ndpr_ifp),
+ error));
+ /* proceed anyway. XXX: is it correct? */
+ }
+ ND6_ONLINK_UNLOCK();
+ }
+}
+
static int
prelist_update(struct nd_prefixctl *new, struct nd_defrouter *dr,
bool auth, int mcast)
@@ -1512,44 +1551,9 @@
NET_EPOCH_ASSERT();
+ /* check if prefix already exists on the same interface */
if ((pr = nd6_prefix_lookup(new)) != NULL) {
- /*
- * nd6_prefix_lookup() ensures that pr and new have the same
- * prefix on a same interface.
- */
-
- /*
- * Update prefix information. Note that the on-link (L) bit
- * and the autonomous (A) bit should NOT be changed from 1
- * to 0.
- */
- if (new->ndpr_raf_onlink == 1)
- pr->ndpr_raf_onlink = 1;
- if (new->ndpr_raf_auto == 1)
- pr->ndpr_raf_auto = 1;
- if (new->ndpr_raf_onlink) {
- pr->ndpr_vltime = new->ndpr_vltime;
- pr->ndpr_pltime = new->ndpr_pltime;
- in6_init_prefix_ltimes(pr);
- pr->ndpr_lastupdate = time_uptime;
- }
-
- if (new->ndpr_raf_onlink &&
- (pr->ndpr_stateflags & NDPRF_ONLINK) == 0) {
- ND6_ONLINK_LOCK();
- if ((error = nd6_prefix_onlink(pr)) != 0) {
- nd6log((LOG_ERR,
- "%s: failed to make the prefix %s/%d "
- "on-link on %s (errno=%d)\n", __func__,
- ip6_sprintf(ip6buf,
- &pr->ndpr_prefix.sin6_addr),
- pr->ndpr_plen, if_name(pr->ndpr_ifp),
- error));
- /* proceed anyway. XXX: is it correct? */
- }
- ND6_ONLINK_UNLOCK();
- }
-
+ nd6_prefix_update(new, pr);
if (dr != NULL)
pfxrtr_add(pr, dr);
} else {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, May 27, 7:34 AM (3 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30552330
Default Alt Text
D56130.id174454.diff (2 KB)
Attached To
Mode
D56130: nd6: break nd6_prefix_update out of prelist_update
Attached
Detach File
Event Timeline
Log In to Comment