|
@@ -981,17 +981,28 @@ static int ndp_register_settings ( struct net_device *netdev,
|
981
|
981
|
size_t option_len;
|
982
|
982
|
unsigned int prefixes;
|
983
|
983
|
unsigned int instance;
|
|
984
|
+ int order;
|
984
|
985
|
int rc;
|
985
|
986
|
|
986
|
987
|
/* Count number of prefix options. We can assume that the
|
987
|
988
|
* options are well-formed, otherwise they would have been
|
988
|
989
|
* rejected prior to being stored.
|
989
|
990
|
*/
|
|
991
|
+ order = IPV6_ORDER_PREFIX_ONLY;
|
990
|
992
|
for ( prefixes = 0, offset = 0 ; offset < len ; offset += option_len ) {
|
|
993
|
+
|
|
994
|
+ /* Skip non-prefix options */
|
991
|
995
|
option = ( ( ( void * ) options ) + offset );
|
992
|
996
|
option_len = ( option->header.blocks * NDP_OPTION_BLKSZ );
|
993
|
|
- if ( option->header.type == NDP_OPT_PREFIX )
|
994
|
|
- prefixes++;
|
|
997
|
+ if ( option->header.type != NDP_OPT_PREFIX )
|
|
998
|
+ continue;
|
|
999
|
+
|
|
1000
|
+ /* Count number of prefixes */
|
|
1001
|
+ prefixes++;
|
|
1002
|
+
|
|
1003
|
+ /* Increase overall order if we have SLAAC addresses */
|
|
1004
|
+ if ( option->prefix.flags & NDP_PREFIX_AUTONOMOUS )
|
|
1005
|
+ order = IPV6_ORDER_SLAAC;
|
995
|
1006
|
}
|
996
|
1007
|
|
997
|
1008
|
/* Allocate and initialise structure */
|
|
@@ -1004,6 +1015,7 @@ static int ndp_register_settings ( struct net_device *netdev,
|
1004
|
1015
|
ref_init ( &ndpset->refcnt, NULL );
|
1005
|
1016
|
settings_init ( &ndpset->settings, &ndp_settings_operations,
|
1006
|
1017
|
&ndpset->refcnt, &ndp_settings_scope );
|
|
1018
|
+ ndpset->settings.order = order;
|
1007
|
1019
|
memcpy ( &ndpset->router, router, sizeof ( ndpset->router ) );
|
1008
|
1020
|
ndpset->lifetime = lifetime;
|
1009
|
1021
|
ndpset->len = len;
|
|
@@ -1028,6 +1040,9 @@ static int ndp_register_settings ( struct net_device *netdev,
|
1028
|
1040
|
settings_init ( &prefset->settings,
|
1029
|
1041
|
&ndp_prefix_settings_operations,
|
1030
|
1042
|
&ndpset->refcnt, &ndp_settings_scope );
|
|
1043
|
+ prefset->settings.order =
|
|
1044
|
+ ( ( option->prefix.flags & NDP_PREFIX_AUTONOMOUS ) ?
|
|
1045
|
+ IPV6_ORDER_SLAAC : IPV6_ORDER_PREFIX_ONLY );
|
1031
|
1046
|
prefset->prefix = &option->prefix;
|
1032
|
1047
|
snprintf ( prefset->name, sizeof ( prefset->name ), "%d",
|
1033
|
1048
|
instance++ );
|