iPXE
ndp.c
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2013 Michael Brown <mbrown@fensystems.co.uk>.
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License as
00006  * published by the Free Software Foundation; either version 2 of the
00007  * License, or any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful, but
00010  * WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00017  * 02110-1301, USA.
00018  */
00019 
00020 FILE_LICENCE ( GPL2_OR_LATER );
00021 
00022 #include <stdlib.h>
00023 #include <stdio.h>
00024 #include <string.h>
00025 #include <errno.h>
00026 #include <byteswap.h>
00027 #include <ipxe/in.h>
00028 #include <ipxe/iobuf.h>
00029 #include <ipxe/tcpip.h>
00030 #include <ipxe/ipv6.h>
00031 #include <ipxe/icmpv6.h>
00032 #include <ipxe/neighbour.h>
00033 #include <ipxe/dhcpv6.h>
00034 #include <ipxe/ndp.h>
00035 
00036 /** @file
00037  *
00038  * IPv6 neighbour discovery protocol
00039  *
00040  */
00041 
00042 static struct ipv6conf * ipv6conf_demux ( struct net_device *netdev );
00043 static int
00044 ipv6conf_rx_router_advertisement ( struct net_device *netdev,
00045                                    struct in6_addr *router,
00046                                    struct ndp_router_advertisement_header *radv,
00047                                    size_t len );
00048 
00049 /**
00050  * Transmit NDP packet with link-layer address option
00051  *
00052  * @v netdev            Network device
00053  * @v sin6_src          Source socket address
00054  * @v sin6_dest         Destination socket address
00055  * @v data              NDP header
00056  * @v len               Size of NDP header
00057  * @v option_type       NDP option type
00058  * @ret rc              Return status code
00059  */
00060 static int ndp_tx_ll_addr ( struct net_device *netdev,
00061                             struct sockaddr_in6 *sin6_src,
00062                             struct sockaddr_in6 *sin6_dest,
00063                             const void *data, size_t len,
00064                             unsigned int option_type ) {
00065         struct sockaddr_tcpip *st_src =
00066                 ( ( struct sockaddr_tcpip * ) sin6_src );
00067         struct sockaddr_tcpip *st_dest =
00068                 ( ( struct sockaddr_tcpip * ) sin6_dest );
00069         struct ll_protocol *ll_protocol = netdev->ll_protocol;
00070         struct io_buffer *iobuf;
00071         struct ndp_ll_addr_option *ll_addr_opt;
00072         union ndp_header *ndp;
00073         size_t option_len;
00074         int rc;
00075 
00076         /* Allocate and populate buffer */
00077         option_len = ( ( sizeof ( *ll_addr_opt ) +
00078                          ll_protocol->ll_addr_len + NDP_OPTION_BLKSZ - 1 ) &
00079                        ~( NDP_OPTION_BLKSZ - 1 ) );
00080         iobuf = alloc_iob ( MAX_LL_NET_HEADER_LEN + len + option_len );
00081         if ( ! iobuf )
00082                 return -ENOMEM;
00083         iob_reserve ( iobuf, MAX_LL_NET_HEADER_LEN );
00084         memcpy ( iob_put ( iobuf, len ), data, len );
00085         ll_addr_opt = iob_put ( iobuf, option_len );
00086         ll_addr_opt->header.type = option_type;
00087         ll_addr_opt->header.blocks = ( option_len / NDP_OPTION_BLKSZ );
00088         memcpy ( ll_addr_opt->ll_addr, netdev->ll_addr,
00089                  ll_protocol->ll_addr_len );
00090         ndp = iobuf->data;
00091         ndp->icmp.chksum = tcpip_chksum ( ndp, ( len + option_len ) );
00092 
00093         /* Transmit packet */
00094         if ( ( rc = tcpip_tx ( iobuf, &icmpv6_protocol, st_src, st_dest,
00095                                netdev, &ndp->icmp.chksum ) ) != 0 ) {
00096                 DBGC ( netdev, "NDP %s could not transmit packet: %s\n",
00097                        netdev->name, strerror ( rc ) );
00098                 return rc;
00099         }
00100 
00101         return 0;
00102 }
00103 
00104 /**
00105  * Transmit NDP neighbour discovery request
00106  *
00107  * @v netdev            Network device
00108  * @v net_protocol      Network-layer protocol
00109  * @v net_dest          Destination network-layer address
00110  * @v net_source        Source network-layer address
00111  * @ret rc              Return status code
00112  */
00113 static int ndp_tx_request ( struct net_device *netdev,
00114                             struct net_protocol *net_protocol __unused,
00115                             const void *net_dest, const void *net_source ) {
00116         struct sockaddr_in6 sin6_src;
00117         struct sockaddr_in6 sin6_dest;
00118         struct ndp_neighbour_header neigh;
00119         int rc;
00120 
00121         /* Construct source address */
00122         memset ( &sin6_src, 0, sizeof ( sin6_src ) );
00123         sin6_src.sin6_family = AF_INET6;
00124         memcpy ( &sin6_src.sin6_addr, net_source,
00125                  sizeof ( sin6_src.sin6_addr ) );
00126 
00127         /* Construct multicast destination address */
00128         memset ( &sin6_dest, 0, sizeof ( sin6_dest ) );
00129         sin6_dest.sin6_family = AF_INET6;
00130         sin6_dest.sin6_scope_id = netdev->index;
00131         ipv6_solicited_node ( &sin6_dest.sin6_addr, net_dest );
00132 
00133         /* Construct neighbour header */
00134         memset ( &neigh, 0, sizeof ( neigh ) );
00135         neigh.icmp.type = ICMPV6_NEIGHBOUR_SOLICITATION;
00136         memcpy ( &neigh.target, net_dest, sizeof ( neigh.target ) );
00137 
00138         /* Transmit neighbour discovery packet */
00139         if ( ( rc = ndp_tx_ll_addr ( netdev, &sin6_src, &sin6_dest, &neigh,
00140                                      sizeof ( neigh ),
00141                                      NDP_OPT_LL_SOURCE ) ) != 0 )
00142                 return rc;
00143 
00144         return 0;
00145 }
00146 
00147 /** NDP neighbour discovery protocol */
00148 struct neighbour_discovery ndp_discovery = {
00149         .name = "NDP",
00150         .tx_request = ndp_tx_request,
00151 };
00152 
00153 /**
00154  * Transmit NDP router solicitation
00155  *
00156  * @v netdev            Network device
00157  * @ret rc              Return status code
00158  */
00159 static int ndp_tx_router_solicitation ( struct net_device *netdev ) {
00160         struct ndp_router_solicitation_header rsol;
00161         struct sockaddr_in6 sin6_dest;
00162         int rc;
00163 
00164         /* Construct multicast destination address */
00165         memset ( &sin6_dest, 0, sizeof ( sin6_dest ) );
00166         sin6_dest.sin6_family = AF_INET6;
00167         sin6_dest.sin6_scope_id = netdev->index;
00168         ipv6_all_routers ( &sin6_dest.sin6_addr );
00169 
00170         /* Construct router solicitation */
00171         memset ( &rsol, 0, sizeof ( rsol ) );
00172         rsol.icmp.type = ICMPV6_ROUTER_SOLICITATION;
00173 
00174         /* Transmit packet */
00175         if ( ( rc = ndp_tx_ll_addr ( netdev, NULL, &sin6_dest, &rsol,
00176                                      sizeof ( rsol ), NDP_OPT_LL_SOURCE ) ) !=0)
00177                 return rc;
00178 
00179         return 0;
00180 }
00181 
00182 /**
00183  * Process NDP neighbour solicitation source link-layer address option
00184  *
00185  * @v netdev            Network device
00186  * @v sin6_src          Source socket address
00187  * @v ndp               NDP packet
00188  * @v option            NDP option
00189  * @v len               NDP option length
00190  * @ret rc              Return status code
00191  */
00192 static int
00193 ndp_rx_neighbour_solicitation_ll_source ( struct net_device *netdev,
00194                                           struct sockaddr_in6 *sin6_src,
00195                                           union ndp_header *ndp,
00196                                           union ndp_option *option,
00197                                           size_t len ) {
00198         struct ndp_neighbour_header *neigh = &ndp->neigh;
00199         struct ndp_ll_addr_option *ll_addr_opt = &option->ll_addr;
00200         struct ll_protocol *ll_protocol = netdev->ll_protocol;
00201         int rc;
00202 
00203         /* Silently ignore neighbour solicitations for addresses we do
00204          * not own.
00205          */
00206         if ( ! ipv6_has_addr ( netdev, &neigh->target ) )
00207                 return 0;
00208 
00209         /* Sanity check */
00210         if ( offsetof ( typeof ( *ll_addr_opt ),
00211                         ll_addr[ll_protocol->ll_addr_len] ) > len ) {
00212                 DBGC ( netdev, "NDP %s neighbour solicitation link-layer "
00213                        "address option too short at %zd bytes\n",
00214                        netdev->name, len );
00215                 return -EINVAL;
00216         }
00217 
00218         /* Create or update neighbour cache entry */
00219         if ( ( rc = neighbour_define ( netdev, &ipv6_protocol,
00220                                        &sin6_src->sin6_addr,
00221                                        ll_addr_opt->ll_addr ) ) != 0 ) {
00222                 DBGC ( netdev, "NDP %s could not define %s => %s: %s\n",
00223                        netdev->name, inet6_ntoa ( &sin6_src->sin6_addr ),
00224                        ll_protocol->ntoa ( ll_addr_opt->ll_addr ),
00225                        strerror ( rc ) );
00226                 return rc;
00227         }
00228 
00229         /* Convert neighbour header to advertisement */
00230         memset ( neigh, 0, offsetof ( typeof ( *neigh ), target ) );
00231         neigh->icmp.type = ICMPV6_NEIGHBOUR_ADVERTISEMENT;
00232         neigh->flags = ( NDP_NEIGHBOUR_SOLICITED | NDP_NEIGHBOUR_OVERRIDE );
00233 
00234         /* Send neighbour advertisement */
00235         if ( ( rc = ndp_tx_ll_addr ( netdev, NULL, sin6_src, neigh,
00236                                      sizeof ( *neigh ),
00237                                      NDP_OPT_LL_TARGET ) ) != 0 )
00238                 return rc;
00239 
00240         return 0;
00241 }
00242 
00243 /**
00244  * Process NDP neighbour advertisement target link-layer address option
00245  *
00246  * @v netdev            Network device
00247  * @v sin6_src          Source socket address
00248  * @v ndp               NDP packet
00249  * @v option            NDP option
00250  * @v len               NDP option length
00251  * @ret rc              Return status code
00252  */
00253 static int
00254 ndp_rx_neighbour_advertisement_ll_target ( struct net_device *netdev,
00255                                            struct sockaddr_in6 *sin6_src
00256                                                    __unused,
00257                                            union ndp_header *ndp,
00258                                            union ndp_option *option,
00259                                            size_t len ) {
00260         struct ndp_neighbour_header *neigh = &ndp->neigh;
00261         struct ndp_ll_addr_option *ll_addr_opt = &option->ll_addr;
00262         struct ll_protocol *ll_protocol = netdev->ll_protocol;
00263         int rc;
00264 
00265         /* Sanity check */
00266         if ( offsetof ( typeof ( *ll_addr_opt ),
00267                         ll_addr[ll_protocol->ll_addr_len] ) > len ) {
00268                 DBGC ( netdev, "NDP %s neighbour advertisement link-layer "
00269                        "address option too short at %zd bytes\n",
00270                        netdev->name, len );
00271                 return -EINVAL;
00272         }
00273 
00274         /* Update neighbour cache entry, if any */
00275         if ( ( rc = neighbour_update ( netdev, &ipv6_protocol, &neigh->target,
00276                                        ll_addr_opt->ll_addr ) ) != 0 ) {
00277                 DBGC ( netdev, "NDP %s could not update %s => %s: %s\n",
00278                        netdev->name, inet6_ntoa ( &neigh->target ),
00279                        ll_protocol->ntoa ( ll_addr_opt->ll_addr ),
00280                        strerror ( rc ) );
00281                 return rc;
00282         }
00283 
00284         return 0;
00285 }
00286 
00287 /**
00288  * Process NDP router advertisement source link-layer address option
00289  *
00290  * @v netdev            Network device
00291  * @v sin6_src          Source socket address
00292  * @v ndp               NDP packet
00293  * @v option            NDP option
00294  * @v len               NDP option length
00295  * @ret rc              Return status code
00296  */
00297 static int
00298 ndp_rx_router_advertisement_ll_source ( struct net_device *netdev,
00299                                         struct sockaddr_in6 *sin6_src,
00300                                         union ndp_header *ndp __unused,
00301                                         union ndp_option *option, size_t len ) {
00302         struct ndp_ll_addr_option *ll_addr_opt = &option->ll_addr;
00303         struct ll_protocol *ll_protocol = netdev->ll_protocol;
00304         int rc;
00305 
00306         /* Sanity check */
00307         if ( offsetof ( typeof ( *ll_addr_opt ),
00308                         ll_addr[ll_protocol->ll_addr_len] ) > len ) {
00309                 DBGC ( netdev, "NDP %s router advertisement link-layer address "
00310                        "option too short at %zd bytes\n", netdev->name, len );
00311                 return -EINVAL;
00312         }
00313 
00314         /* Define neighbour cache entry */
00315         if ( ( rc = neighbour_define ( netdev, &ipv6_protocol,
00316                                        &sin6_src->sin6_addr,
00317                                        ll_addr_opt->ll_addr ) ) != 0 ) {
00318                 DBGC ( netdev, "NDP %s could not define %s => %s: %s\n",
00319                        netdev->name, inet6_ntoa ( &sin6_src->sin6_addr ),
00320                        ll_protocol->ntoa ( ll_addr_opt->ll_addr ),
00321                        strerror ( rc ) );
00322                 return rc;
00323         }
00324 
00325         return 0;
00326 }
00327 
00328 /**
00329  * Process NDP router advertisement prefix information option
00330  *
00331  * @v netdev            Network device
00332  * @v sin6_src          Source socket address
00333  * @v ndp               NDP packet
00334  * @v option            NDP option
00335  * @v len               NDP option length
00336  * @ret rc              Return status code
00337  */
00338 static int
00339 ndp_rx_router_advertisement_prefix ( struct net_device *netdev,
00340                                      struct sockaddr_in6 *sin6_src,
00341                                      union ndp_header *ndp,
00342                                      union ndp_option *option, size_t len ) {
00343         struct ndp_router_advertisement_header *radv = &ndp->radv;
00344         struct ndp_prefix_information_option *prefix_opt = &option->prefix;
00345 
00346         /* Sanity check */
00347         if ( sizeof ( *prefix_opt ) > len ) {
00348                 DBGC ( netdev, "NDP %s router advertisement prefix option too "
00349                        "short at %zd bytes\n", netdev->name, len );
00350                 return -EINVAL;
00351         }
00352 
00353         DBGC ( netdev, "NDP %s found %sdefault router %s ",
00354                netdev->name, ( radv->lifetime ? "" : "non-" ),
00355                inet6_ntoa ( &sin6_src->sin6_addr ) );
00356         DBGC ( netdev, "for %s-link %sautonomous prefix %s/%d\n",
00357                ( ( prefix_opt->flags & NDP_PREFIX_ON_LINK ) ? "on" : "off" ),
00358                ( ( prefix_opt->flags & NDP_PREFIX_AUTONOMOUS ) ? "" : "non-" ),
00359                inet6_ntoa ( &prefix_opt->prefix ), prefix_opt->prefix_len );
00360 
00361         return 0;
00362 }
00363 
00364 /** An NDP option handler */
00365 struct ndp_option_handler {
00366         /** ICMPv6 type */
00367         uint8_t icmp_type;
00368         /** Option type */
00369         uint8_t option_type;
00370         /**
00371          * Handle received option
00372          *
00373          * @v netdev            Network device
00374          * @v sin6_src          Source socket address
00375          * @v ndp               NDP packet
00376          * @v option            NDP option
00377          * @ret rc              Return status code
00378          */
00379         int ( * rx ) ( struct net_device *netdev, struct sockaddr_in6 *sin6_src,
00380                        union ndp_header *ndp, union ndp_option *option,
00381                        size_t len );
00382 };
00383 
00384 /** NDP option handlers */
00385 static struct ndp_option_handler ndp_option_handlers[] = {
00386         {
00387                 .icmp_type = ICMPV6_NEIGHBOUR_SOLICITATION,
00388                 .option_type = NDP_OPT_LL_SOURCE,
00389                 .rx = ndp_rx_neighbour_solicitation_ll_source,
00390         },
00391         {
00392                 .icmp_type = ICMPV6_NEIGHBOUR_ADVERTISEMENT,
00393                 .option_type = NDP_OPT_LL_TARGET,
00394                 .rx = ndp_rx_neighbour_advertisement_ll_target,
00395         },
00396         {
00397                 .icmp_type = ICMPV6_ROUTER_ADVERTISEMENT,
00398                 .option_type = NDP_OPT_LL_SOURCE,
00399                 .rx = ndp_rx_router_advertisement_ll_source,
00400         },
00401         {
00402                 .icmp_type = ICMPV6_ROUTER_ADVERTISEMENT,
00403                 .option_type = NDP_OPT_PREFIX,
00404                 .rx = ndp_rx_router_advertisement_prefix,
00405         },
00406 };
00407 
00408 /**
00409  * Process received NDP option
00410  *
00411  * @v netdev            Network device
00412  * @v sin6_src          Source socket address
00413  * @v ndp               NDP packet
00414  * @v option            NDP option
00415  * @v len               Option length
00416  * @ret rc              Return status code
00417  */
00418 static int ndp_rx_option ( struct net_device *netdev,
00419                            struct sockaddr_in6 *sin6_src, union ndp_header *ndp,
00420                            union ndp_option *option, size_t len ) {
00421         struct ndp_option_handler *handler;
00422         unsigned int i;
00423 
00424         /* Locate a suitable option handler, if any */
00425         for ( i = 0 ; i < ( sizeof ( ndp_option_handlers ) /
00426                             sizeof ( ndp_option_handlers[0] ) ) ; i++ ) {
00427                 handler = &ndp_option_handlers[i];
00428                 if ( ( handler->icmp_type == ndp->icmp.type ) &&
00429                      ( handler->option_type == option->header.type ) ) {
00430                         return handler->rx ( netdev, sin6_src, ndp,
00431                                              option, len );
00432                 }
00433         }
00434 
00435         /* Silently ignore unknown options as per RFC 4861 */
00436         return 0;
00437 }
00438 
00439 /**
00440  * Process received NDP packet options
00441  *
00442  * @v netdev            Network device
00443  * @v sin6_src          Source socket address
00444  * @v ndp               NDP header
00445  * @v offset            Offset to NDP options
00446  * @v len               Length of NDP packet
00447  * @ret rc              Return status code
00448  */
00449 static int ndp_rx_options ( struct net_device *netdev,
00450                             struct sockaddr_in6 *sin6_src,
00451                             union ndp_header *ndp, size_t offset, size_t len ) {
00452         union ndp_option *option;
00453         size_t remaining;
00454         size_t option_len;
00455         int rc;
00456 
00457         /* Sanity check */
00458         if ( len < offset ) {
00459                 DBGC ( netdev, "NDP %s packet too short at %zd bytes (min %zd "
00460                        "bytes)\n", netdev->name, len, offset );
00461                 return -EINVAL;
00462         }
00463 
00464         /* Search for option */
00465         option = ( ( ( void * ) ndp ) + offset );
00466         remaining = ( len - offset );
00467         while ( remaining ) {
00468 
00469                 /* Sanity check */
00470                 if ( ( remaining < sizeof ( option->header ) ) ||
00471                      ( option->header.blocks == 0 ) ||
00472                      ( remaining < ( option->header.blocks *
00473                                      NDP_OPTION_BLKSZ ) ) ) {
00474                         DBGC ( netdev, "NDP %s bad option length:\n",
00475                                netdev->name );
00476                         DBGC_HDA ( netdev, 0, option, remaining );
00477                         return -EINVAL;
00478                 }
00479                 option_len = ( option->header.blocks * NDP_OPTION_BLKSZ );
00480 
00481                 /* Handle option */
00482                 if ( ( rc = ndp_rx_option ( netdev, sin6_src, ndp, option,
00483                                             option_len ) ) != 0 )
00484                         return rc;
00485 
00486                 /* Move to next option */
00487                 option = ( ( ( void * ) option ) + option_len );
00488                 remaining -= option_len;
00489         }
00490 
00491         return 0;
00492 }
00493 
00494 /**
00495  * Process received NDP neighbour solicitation or advertisement
00496  *
00497  * @v iobuf             I/O buffer
00498  * @v netdev            Network device
00499  * @v sin6_src          Source socket address
00500  * @v sin6_dest         Destination socket address
00501  * @ret rc              Return status code
00502  */
00503 static int ndp_rx_neighbour ( struct io_buffer *iobuf,
00504                               struct net_device *netdev,
00505                               struct sockaddr_in6 *sin6_src,
00506                               struct sockaddr_in6 *sin6_dest __unused ) {
00507         union ndp_header *ndp = iobuf->data;
00508         struct ndp_neighbour_header *neigh = &ndp->neigh;
00509         size_t len = iob_len ( iobuf );
00510         int rc;
00511 
00512         /* Process options */
00513         if ( ( rc = ndp_rx_options ( netdev, sin6_src, ndp,
00514                                      offsetof ( typeof ( *neigh ), option ),
00515                                      len ) ) != 0 )
00516                 goto err_options;
00517 
00518  err_options:
00519         free_iob ( iobuf );
00520         return rc;
00521 }
00522 
00523 /**
00524  * Process received NDP router advertisement
00525  *
00526  * @v iobuf             I/O buffer
00527  * @v netdev            Network device
00528  * @v sin6_src          Source socket address
00529  * @v sin6_dest         Destination socket address
00530  * @ret rc              Return status code
00531  */
00532 static int
00533 ndp_rx_router_advertisement ( struct io_buffer *iobuf,
00534                               struct net_device *netdev,
00535                               struct sockaddr_in6 *sin6_src,
00536                               struct sockaddr_in6 *sin6_dest __unused ) {
00537         union ndp_header *ndp = iobuf->data;
00538         struct ndp_router_advertisement_header *radv = &ndp->radv;
00539         struct in6_addr *router = &sin6_src->sin6_addr;
00540         size_t len = iob_len ( iobuf );
00541         int rc;
00542 
00543         /* Process options */
00544         if ( ( rc = ndp_rx_options ( netdev, sin6_src, ndp,
00545                                      offsetof ( typeof ( *radv ), option ),
00546                                      len ) ) != 0 )
00547                 goto err_options;
00548 
00549         /* Pass to IPv6 autoconfiguration */
00550         if ( ( rc = ipv6conf_rx_router_advertisement ( netdev, router,
00551                                                        radv, len ) ) != 0 )
00552                 goto err_ipv6conf;
00553 
00554  err_ipv6conf:
00555  err_options:
00556         free_iob ( iobuf );
00557         return rc;
00558 }
00559 
00560 /** NDP ICMPv6 handlers */
00561 struct icmpv6_handler ndp_handlers[] __icmpv6_handler = {
00562         {
00563                 .type = ICMPV6_NEIGHBOUR_SOLICITATION,
00564                 .rx = ndp_rx_neighbour,
00565         },
00566         {
00567                 .type = ICMPV6_NEIGHBOUR_ADVERTISEMENT,
00568                 .rx = ndp_rx_neighbour,
00569         },
00570         {
00571                 .type = ICMPV6_ROUTER_ADVERTISEMENT,
00572                 .rx = ndp_rx_router_advertisement,
00573         },
00574 };
00575 
00576 /****************************************************************************
00577  *
00578  * NDP settings
00579  *
00580  */
00581 
00582 /** An NDP prefix settings block */
00583 struct ndp_prefix_settings {
00584         /** Settings interface */
00585         struct settings settings;
00586         /** Name */
00587         char name[4];
00588         /** Prefix information option */
00589         struct ndp_prefix_information_option *prefix;
00590 };
00591 
00592 /** An NDP settings block */
00593 struct ndp_settings {
00594         /** Reference counter */
00595         struct refcnt refcnt;
00596         /** Settings interface */
00597         struct settings settings;
00598         /** Router address */
00599         struct in6_addr router;
00600         /** Router lifetime */
00601         unsigned int lifetime;
00602         /** Length of NDP options */
00603         size_t len;
00604         /** NDP options */
00605         union ndp_option options[0];
00606 };
00607 
00608 /** NDP settings scope */
00609 static const struct settings_scope ndp_settings_scope;
00610 
00611 /**
00612  * Construct NDP tag
00613  *
00614  * @v type              NDP option type
00615  * @v offset            Starting offset of data
00616  * @v len               Length of data (or 0 to use all remaining data)
00617  * @ret tag             NDP tag
00618  */
00619 #define NDP_TAG( type, offset, len ) \
00620         ( ( (len) << 16 ) | ( (offset) << 8 ) | (type) )
00621 
00622 /**
00623  * Extract NDP tag type
00624  *
00625  * @v tag               NDP tag
00626  * @ret type            NDP option type
00627  */
00628 #define NDP_TAG_TYPE( tag ) ( ( (tag) >> 0 ) & 0xff )
00629 
00630 /**
00631  * Extract NDP tag offset
00632  *
00633  * @v tag               NDP tag
00634  * @ret offset          Starting offset of data
00635  */
00636 #define NDP_TAG_OFFSET( tag ) ( ( (tag) >> 8 ) & 0xff )
00637 
00638 /**
00639  * Extract NDP tag length
00640  *
00641  * @v tag               NDP tag
00642  * @ret len             Length of data (or 0 to use all remaining data)
00643  */
00644 #define NDP_TAG_LEN( tag ) ( ( (tag) >> 16 ) & 0xff )
00645 
00646 /**
00647  * Extract NDP tag instance
00648  *
00649  * @v tag               NDP tag
00650  * @ret instance        Instance
00651  */
00652 #define NDP_TAG_INSTANCE( tag ) ( ( (tag) >> 24 ) & 0xff )
00653 
00654 /**
00655  * Check applicability of NDP setting
00656  *
00657  * @v settings          Settings block
00658  * @v setting           Setting to fetch
00659  * @ret applies         Setting applies within this settings block
00660  */
00661 static int ndp_applies ( struct settings *settings __unused,
00662                          const struct setting *setting ) {
00663 
00664         return ( setting->scope == &ndp_settings_scope );
00665 }
00666 
00667 /**
00668  * Fetch value of NDP setting
00669  *
00670  * @v settings          Settings block
00671  * @v setting           Setting to fetch
00672  * @v data              Buffer to fill with setting data
00673  * @v len               Length of buffer
00674  * @ret len             Length of setting data, or negative error
00675  */
00676 static int ndp_fetch ( struct settings *settings,
00677                        struct setting *setting,
00678                        void *data, size_t len ) {
00679         struct ndp_settings *ndpset =
00680                 container_of ( settings, struct ndp_settings, settings );
00681         struct net_device *netdev =
00682                 container_of ( settings->parent, struct net_device,
00683                                settings.settings );
00684         union ndp_option *option;
00685         unsigned int tag_type;
00686         unsigned int tag_offset;
00687         unsigned int tag_len;
00688         unsigned int tag_instance;
00689         size_t offset;
00690         size_t option_len;
00691         void *option_data;
00692 
00693         /* Parse setting tag */
00694         tag_type = NDP_TAG_TYPE ( setting->tag );
00695         tag_offset = NDP_TAG_OFFSET ( setting->tag );
00696         tag_len = NDP_TAG_LEN ( setting->tag );
00697         tag_instance = NDP_TAG_INSTANCE ( setting->tag );
00698 
00699         /* Scan through NDP options for requested type.  We can assume
00700          * that the options are well-formed, otherwise they would have
00701          * been rejected prior to being stored.
00702          */
00703         for ( offset = 0 ; offset < ndpset->len ; offset += option_len ) {
00704 
00705                 /* Calculate option length */
00706                 option = ( ( ( void * ) ndpset->options ) + offset );
00707                 option_len = ( option->header.blocks * NDP_OPTION_BLKSZ );
00708 
00709                 /* Skip options that do not match this tag */
00710                 if ( option->header.type != tag_type )
00711                         continue;
00712 
00713                 /* Skip previous instances of this option */
00714                 if ( tag_instance-- != 0 )
00715                         continue;
00716 
00717                 /* Sanity check */
00718                 if ( ( tag_offset + tag_len ) > option_len ) {
00719                         DBGC ( netdev, "NDP %s option %d too short\n",
00720                                netdev->name, tag_type );
00721                         return -EINVAL;
00722                 }
00723                 if ( ! tag_len )
00724                         tag_len = ( option_len - tag_offset );
00725                 option_data = ( ( ( void * ) option ) + tag_offset );
00726 
00727                 /* Copy data to output buffer */
00728                 if ( len > tag_len )
00729                         len = tag_len;
00730                 memcpy ( data, option_data, len );
00731 
00732                 /* Default to hex if no type is specified */
00733                 if ( ! setting->type )
00734                         setting->type = &setting_type_hex;
00735 
00736                 return tag_len;
00737         }
00738 
00739         return -ENOENT;
00740 }
00741 
00742 /** NDP settings operations */
00743 static struct settings_operations ndp_settings_operations = {
00744         .applies = ndp_applies,
00745         .fetch = ndp_fetch,
00746 };
00747 
00748 /**
00749  * Check applicability of NDP per-prefix setting
00750  *
00751  * @v settings          Settings block
00752  * @v setting           Setting to fetch
00753  * @ret applies         Setting applies within this settings block
00754  */
00755 static int ndp_prefix_applies ( struct settings *settings __unused,
00756                                 const struct setting *setting ) {
00757 
00758         return ( setting->scope == &ipv6_settings_scope );
00759 }
00760 
00761 /**
00762  * Fetch value of NDP IPv6 address setting
00763  *
00764  * @v settings          Settings block
00765  * @v data              Buffer to fill with setting data
00766  * @v len               Length of buffer
00767  * @ret len             Length of setting data, or negative error
00768  */
00769 static int ndp_prefix_fetch_ip6 ( struct settings *settings, void *data,
00770                                   size_t len ) {
00771         struct ndp_prefix_settings *prefset =
00772                 container_of ( settings, struct ndp_prefix_settings, settings );
00773         struct ndp_settings *ndpset =
00774                 container_of ( settings->parent, struct ndp_settings, settings);
00775         struct net_device *netdev =
00776                 container_of ( ndpset->settings.parent, struct net_device,
00777                                settings.settings );
00778         struct ndp_prefix_information_option *prefix = prefset->prefix;
00779         struct in6_addr ip6;
00780         int prefix_len;
00781 
00782         /* Skip dead prefixes */
00783         if ( ! prefix->valid )
00784                 return -ENOENT;
00785 
00786         /* Construct IPv6 address via SLAAC, if applicable */
00787         memcpy ( &ip6, &prefix->prefix, sizeof ( ip6 ) );
00788         if ( prefix->flags & NDP_PREFIX_AUTONOMOUS ) {
00789                 prefix_len = ipv6_eui64 ( &ip6, netdev );
00790                 if ( prefix_len < 0 )
00791                         return prefix_len;
00792                 if ( prefix_len != prefix->prefix_len )
00793                         return -EINVAL;
00794         }
00795 
00796         /* Fill in IPv6 address */
00797         if ( len > sizeof ( ip6 ) )
00798                 len = sizeof ( ip6 );
00799         memcpy ( data, &ip6, len );
00800 
00801         return sizeof ( ip6 );
00802 }
00803 
00804 /**
00805  * Fetch value of NDP prefix length setting
00806  *
00807  * @v settings          Settings block
00808  * @v data              Buffer to fill with setting data
00809  * @v len               Length of buffer
00810  * @ret len             Length of setting data, or negative error
00811  */
00812 static int ndp_prefix_fetch_len6 ( struct settings *settings, void *data,
00813                                    size_t len ) {
00814         struct ndp_prefix_settings *prefset =
00815                 container_of ( settings, struct ndp_prefix_settings, settings );
00816         struct ndp_prefix_information_option *prefix = prefset->prefix;
00817         uint8_t *len6;
00818 
00819         /* Fill in prefix length */
00820         if ( len >= sizeof ( *len6 ) ) {
00821                 /* We treat an off-link prefix as having a prefix
00822                  * length covering the entire IPv6 address.
00823                  */
00824                 len6 = data;
00825                 *len6 = ( ( prefix->flags & NDP_PREFIX_ON_LINK ) ?
00826                           prefix->prefix_len : -1UL );
00827         }
00828 
00829         return sizeof ( *len6 );
00830 }
00831 
00832 /**
00833  * Fetch value of NDP router address setting
00834  *
00835  * @v settings          Settings block
00836  * @v data              Buffer to fill with setting data
00837  * @v len               Length of buffer
00838  * @ret len             Length of setting data, or negative error
00839  */
00840 static int ndp_prefix_fetch_gateway6 ( struct settings *settings,
00841                                        void *data, size_t len ) {
00842         struct ndp_settings *ndpset =
00843                 container_of ( settings->parent, struct ndp_settings, settings);
00844 
00845         /* Treat non-routing router as non-existent */
00846         if ( ! ndpset->lifetime )
00847                 return -ENOENT;
00848 
00849         /* Fill in router address */
00850         if ( len > sizeof ( ndpset->router ) )
00851                 len = sizeof ( ndpset->router );
00852         memcpy ( data, &ndpset->router, len );
00853 
00854         return sizeof ( ndpset->router );
00855 }
00856 
00857 /** An NDP per-prefix setting operation */
00858 struct ndp_prefix_operation {
00859         /** Generic setting */
00860         const struct setting *setting;
00861         /**
00862          * Fetch value of setting
00863          *
00864          * @v settings          Settings block
00865          * @v data              Buffer to fill with setting data
00866          * @v len               Length of buffer
00867          * @ret len             Length of setting data, or negative error
00868          */
00869         int ( * fetch ) ( struct settings *settings, void *data, size_t len );
00870 };
00871 
00872 /** NDP per-prefix settings operations */
00873 static struct ndp_prefix_operation ndp_prefix_operations[] = {
00874         { &ip6_setting, ndp_prefix_fetch_ip6 },
00875         { &len6_setting, ndp_prefix_fetch_len6 },
00876         { &gateway6_setting, ndp_prefix_fetch_gateway6 },
00877 };
00878 
00879 /**
00880  * Fetch value of NDP pre-prefix setting
00881  *
00882  * @v settings          Settings block
00883  * @v setting           Setting to fetch
00884  * @v data              Buffer to fill with setting data
00885  * @v len               Length of buffer
00886  * @ret len             Length of setting data, or negative error
00887  */
00888 static int ndp_prefix_fetch ( struct settings *settings,
00889                               struct setting *setting,
00890                               void *data, size_t len ) {
00891         struct ndp_prefix_operation *op;
00892         unsigned int i;
00893 
00894         /* Handle per-prefix settings */
00895         for ( i = 0 ; i < ( sizeof ( ndp_prefix_operations ) /
00896                             sizeof ( ndp_prefix_operations[0] ) ) ; i++ ) {
00897                 op = &ndp_prefix_operations[i];
00898                 if ( setting_cmp ( setting, op->setting ) == 0 )
00899                         return op->fetch ( settings, data, len );
00900         }
00901 
00902         return -ENOENT;
00903 }
00904 
00905 /** NDP per-prefix settings operations */
00906 static struct settings_operations ndp_prefix_settings_operations = {
00907         .applies = ndp_prefix_applies,
00908         .fetch = ndp_prefix_fetch,
00909 };
00910 
00911 /**
00912  * Register NDP settings
00913  *
00914  * @v netdev            Network device
00915  * @v router            Router address
00916  * @v lifetime          Router lifetime
00917  * @v options           NDP options
00918  * @v len               Length of options
00919  * @ret rc              Return status code
00920  */
00921 static int ndp_register_settings ( struct net_device *netdev,
00922                                    struct in6_addr *router,
00923                                    unsigned int lifetime,
00924                                    union ndp_option *options, size_t len ) {
00925         struct settings *parent = netdev_settings ( netdev );
00926         union ndp_option *option;
00927         struct ndp_settings *ndpset;
00928         struct ndp_prefix_settings *prefset;
00929         size_t offset;
00930         size_t option_len;
00931         unsigned int prefixes;
00932         unsigned int instance;
00933         int order;
00934         int rc;
00935 
00936         /* Count number of prefix options.  We can assume that the
00937          * options are well-formed, otherwise they would have been
00938          * rejected prior to being stored.
00939          */
00940         order = IPV6_ORDER_PREFIX_ONLY;
00941         for ( prefixes = 0, offset = 0 ; offset < len ; offset += option_len ) {
00942 
00943                 /* Skip non-prefix options */
00944                 option = ( ( ( void * ) options ) + offset );
00945                 option_len = ( option->header.blocks * NDP_OPTION_BLKSZ );
00946                 if ( option->header.type != NDP_OPT_PREFIX )
00947                         continue;
00948 
00949                 /* Count number of prefixes */
00950                 prefixes++;
00951 
00952                 /* Increase overall order if we have SLAAC addresses */
00953                 if ( option->prefix.flags & NDP_PREFIX_AUTONOMOUS )
00954                         order = IPV6_ORDER_SLAAC;
00955         }
00956 
00957         /* Allocate and initialise structure */
00958         ndpset = zalloc ( sizeof ( *ndpset ) + len +
00959                           ( prefixes * sizeof ( *prefset ) ) );
00960         if ( ! ndpset ) {
00961                 rc = -ENOMEM;
00962                 goto err_alloc;
00963         }
00964         ref_init ( &ndpset->refcnt, NULL );
00965         settings_init ( &ndpset->settings, &ndp_settings_operations,
00966                         &ndpset->refcnt, &ndp_settings_scope );
00967         ndpset->settings.order = order;
00968         memcpy ( &ndpset->router, router, sizeof ( ndpset->router ) );
00969         ndpset->lifetime = lifetime;
00970         ndpset->len = len;
00971         memcpy ( ndpset->options, options, len );
00972         prefset = ( ( ( void * ) ndpset->options ) + len );
00973 
00974         /* Register settings */
00975         if ( ( rc = register_settings ( &ndpset->settings, parent,
00976                                         NDP_SETTINGS_NAME ) ) != 0 )
00977                 goto err_register;
00978 
00979         /* Construct and register per-prefix settings */
00980         for ( instance = 0, offset = 0 ; offset < len ; offset += option_len ) {
00981 
00982                 /* Skip non-prefix options */
00983                 option = ( ( ( void * ) ndpset->options ) + offset );
00984                 option_len = ( option->header.blocks * NDP_OPTION_BLKSZ );
00985                 if ( option->header.type != NDP_OPT_PREFIX )
00986                         continue;
00987 
00988                 /* Initialise structure */
00989                 settings_init ( &prefset->settings,
00990                                 &ndp_prefix_settings_operations,
00991                                 &ndpset->refcnt, &ndp_settings_scope );
00992                 prefset->settings.order =
00993                         ( ( option->prefix.flags & NDP_PREFIX_AUTONOMOUS ) ?
00994                           IPV6_ORDER_SLAAC : IPV6_ORDER_PREFIX_ONLY );
00995                 prefset->prefix = &option->prefix;
00996                 snprintf ( prefset->name, sizeof ( prefset->name ), "%d",
00997                            instance++ );
00998 
00999                 /* Register settings */
01000                 if ( ( rc = register_settings ( &prefset->settings,
01001                                                 &ndpset->settings,
01002                                                 prefset->name ) ) != 0 )
01003                         goto err_register_prefix;
01004 
01005                 /* Move to next per-prefix settings */
01006                 prefset++;
01007         }
01008         assert ( instance == prefixes );
01009 
01010         ref_put ( &ndpset->refcnt );
01011         return 0;
01012 
01013  err_register_prefix:
01014         unregister_settings ( &ndpset->settings );
01015  err_register:
01016         ref_put ( &ndpset->refcnt );
01017  err_alloc:
01018         return rc;
01019 }
01020 
01021 /** DNS server setting */
01022 const struct setting ndp_dns6_setting __setting ( SETTING_IP6_EXTRA, dns6 ) = {
01023         .name = "dns6",
01024         .description = "DNS server",
01025         .tag = NDP_TAG ( NDP_OPT_RDNSS,
01026                          offsetof ( struct ndp_rdnss_option, addresses ), 0 ),
01027         .type = &setting_type_ipv6,
01028         .scope = &ndp_settings_scope,
01029 };
01030 
01031 /** DNS search list setting */
01032 const struct setting ndp_dnssl_setting __setting ( SETTING_IP_EXTRA, dnssl ) = {
01033         .name = "dnssl",
01034         .description = "DNS search list",
01035         .tag = NDP_TAG ( NDP_OPT_DNSSL,
01036                          offsetof ( struct ndp_dnssl_option, names ), 0 ),
01037         .type = &setting_type_dnssl,
01038         .scope = &ndp_settings_scope,
01039 };
01040 
01041 /****************************************************************************
01042  *
01043  * IPv6 autoconfiguration
01044  *
01045  */
01046 
01047 /** An IPv6 configurator */
01048 struct ipv6conf {
01049         /** Reference count */
01050         struct refcnt refcnt;
01051         /** List of configurators */
01052         struct list_head list;
01053 
01054         /** Job control interface */
01055         struct interface job;
01056         /** DHCPv6 interface */
01057         struct interface dhcp;
01058 
01059         /** Network device being configured */
01060         struct net_device *netdev;
01061 
01062         /** Retransmission timer */
01063         struct retry_timer timer;
01064 };
01065 
01066 /** List of IPv6 configurators */
01067 static LIST_HEAD ( ipv6confs );
01068 
01069 /**
01070  * Free IPv6 configurator
01071  *
01072  * @v refcnt            Reference count
01073  */
01074 static void ipv6conf_free ( struct refcnt *refcnt ) {
01075         struct ipv6conf *ipv6conf =
01076                 container_of ( refcnt, struct ipv6conf, refcnt );
01077 
01078         netdev_put ( ipv6conf->netdev );
01079         free ( ipv6conf );
01080 }
01081 
01082 /**
01083  * Identify IPv6 configurator by network device
01084  *
01085  * @v netdev            Network device
01086  * @ret ipv6            IPv6 configurator, or NULL
01087  */
01088 static struct ipv6conf * ipv6conf_demux ( struct net_device *netdev ) {
01089         struct ipv6conf *ipv6conf;
01090 
01091         list_for_each_entry ( ipv6conf, &ipv6confs, list ) {
01092                 if ( ipv6conf->netdev == netdev )
01093                         return ipv6conf;
01094         }
01095         return NULL;
01096 }
01097 
01098 /**
01099  * Finish IPv6 autoconfiguration
01100  *
01101  * @v ipv6              IPv6 configurator
01102  * @v rc                Reason for finishing
01103  */
01104 static void ipv6conf_done ( struct ipv6conf *ipv6conf, int rc ) {
01105 
01106         /* Shut down interfaces */
01107         intf_shutdown ( &ipv6conf->job, rc );
01108         intf_shutdown ( &ipv6conf->dhcp, rc );
01109 
01110         /* Stop timer */
01111         stop_timer ( &ipv6conf->timer );
01112 
01113         /* Remove from list and drop list's reference */
01114         list_del ( &ipv6conf->list );
01115         ref_put ( &ipv6conf->refcnt );
01116 }
01117 
01118 /**
01119  * Handle IPv6 configurator timer expiry
01120  *
01121  * @v timer             Retry timer
01122  * @v fail              Failure indicator
01123  */
01124 static void ipv6conf_expired ( struct retry_timer *timer, int fail ) {
01125         struct ipv6conf *ipv6conf =
01126                 container_of ( timer, struct ipv6conf, timer );
01127 
01128         /* If we have failed, terminate autoconfiguration */
01129         if ( fail ) {
01130                 ipv6conf_done ( ipv6conf, -ETIMEDOUT );
01131                 return;
01132         }
01133 
01134         /* Otherwise, transmit router solicitation and restart timer */
01135         start_timer ( &ipv6conf->timer );
01136         ndp_tx_router_solicitation ( ipv6conf->netdev );
01137 }
01138 
01139 /**
01140  * Handle router advertisement during IPv6 autoconfiguration
01141  *
01142  * @v netdev            Network device
01143  * @v router            Router address
01144  * @v radv              Router advertisement
01145  * @v len               Length of router advertisement
01146  * @ret rc              Return status code
01147  *
01148  * This function assumes that the router advertisement is well-formed,
01149  * since it must have already passed through option processing.
01150  */
01151 static int
01152 ipv6conf_rx_router_advertisement ( struct net_device *netdev,
01153                                    struct in6_addr *router,
01154                                    struct ndp_router_advertisement_header *radv,
01155                                    size_t len ) {
01156         struct ipv6conf *ipv6conf;
01157         size_t option_len;
01158         int stateful;
01159         int rc;
01160 
01161         /* Identify IPv6 configurator, if any */
01162         ipv6conf = ipv6conf_demux ( netdev );
01163 
01164         /* Do nothing unless IPv6 autoconfiguration is in progress */
01165         if ( ! ipv6conf )
01166                 return 0;
01167 
01168         /* If this is not the first solicited router advertisement, ignore it */
01169         if ( ! timer_running ( &ipv6conf->timer ) )
01170                 return 0;
01171 
01172         /* Stop router solicitation timer */
01173         stop_timer ( &ipv6conf->timer );
01174 
01175         /* Register NDP settings */
01176         option_len = ( len - offsetof ( typeof ( *radv ), option ) );
01177         if ( ( rc = ndp_register_settings ( netdev, router,
01178                                             ntohl ( radv->lifetime ),
01179                                             radv->option, option_len ) ) != 0 )
01180                 return rc;
01181 
01182         /* Start DHCPv6 if required */
01183         if ( radv->flags & ( NDP_ROUTER_MANAGED | NDP_ROUTER_OTHER ) ) {
01184                 stateful = ( radv->flags & NDP_ROUTER_MANAGED );
01185                 if ( ( rc = start_dhcpv6 ( &ipv6conf->dhcp, netdev,
01186                                            stateful ) ) != 0 ) {
01187                         DBGC ( netdev, "NDP %s could not start state%s DHCPv6: "
01188                                "%s\n", netdev->name,
01189                                ( stateful ? "ful" : "less" ), strerror ( rc ) );
01190                         ipv6conf_done ( ipv6conf, rc );
01191                         return rc;
01192                 }
01193                 return 0;
01194         }
01195 
01196         /* Otherwise, terminate autoconfiguration */
01197         ipv6conf_done ( ipv6conf, 0 );
01198 
01199         return 0;
01200 }
01201 
01202 /** IPv6 configurator job interface operations */
01203 static struct interface_operation ipv6conf_job_op[] = {
01204         INTF_OP ( intf_close, struct ipv6conf *, ipv6conf_done ),
01205 };
01206 
01207 /** IPv6 configurator job interface descriptor */
01208 static struct interface_descriptor ipv6conf_job_desc =
01209         INTF_DESC ( struct ipv6conf, job, ipv6conf_job_op );
01210 
01211 /** IPv6 configurator DHCPv6 interface operations */
01212 static struct interface_operation ipv6conf_dhcp_op[] = {
01213         INTF_OP ( intf_close, struct ipv6conf *, ipv6conf_done ),
01214 };
01215 
01216 /** IPv6 configurator DHCPv6 interface descriptor */
01217 static struct interface_descriptor ipv6conf_dhcp_desc =
01218         INTF_DESC ( struct ipv6conf, dhcp, ipv6conf_dhcp_op );
01219 
01220 /**
01221  * Start IPv6 autoconfiguration
01222  *
01223  * @v job               Job control interface
01224  * @v netdev            Network device
01225  * @ret rc              Return status code
01226  */
01227 int start_ipv6conf ( struct interface *job, struct net_device *netdev ) {
01228         struct ipv6conf *ipv6conf;
01229 
01230         /* Allocate and initialise structure */
01231         ipv6conf = zalloc ( sizeof ( *ipv6conf ) );
01232         if ( ! ipv6conf )
01233                 return -ENOMEM;
01234         ref_init ( &ipv6conf->refcnt, ipv6conf_free );
01235         intf_init ( &ipv6conf->job, &ipv6conf_job_desc, &ipv6conf->refcnt );
01236         intf_init ( &ipv6conf->dhcp, &ipv6conf_dhcp_desc, &ipv6conf->refcnt );
01237         timer_init ( &ipv6conf->timer, ipv6conf_expired, &ipv6conf->refcnt );
01238         ipv6conf->netdev = netdev_get ( netdev );
01239 
01240         /* Start timer to initiate router solicitation */
01241         start_timer_nodelay ( &ipv6conf->timer );
01242 
01243         /* Attach parent interface, transfer reference to list, and return */
01244         intf_plug_plug ( &ipv6conf->job, job );
01245         list_add ( &ipv6conf->list, &ipv6confs );
01246         return 0;
01247 }
01248 
01249 /** IPv6 network device configurator */
01250 struct net_device_configurator ipv6_configurator __net_device_configurator = {
01251         .name = "ipv6",
01252         .start = start_ipv6conf,
01253 };