2 * Copyright (C) 2013 Michael Brown <mbrown@fensystems.co.uk>.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 FILE_LICENCE ( GPL2_OR_LATER );
23 #include <ipxe/netdevice.h>
24 #include <ipxe/ipv6.h>
25 #include <usr/route.h>
29 * IPv6 routing management
34 * Print IPv6 routing table
36 * @v netdev Network device
38 static void route_ipv6_print ( struct net_device *netdev ) {
39 struct ipv6_miniroute *miniroute;
41 list_for_each_entry ( miniroute, &ipv6_miniroutes, list ) {
42 if ( miniroute->netdev != netdev )
44 printf ( "%s: %s/%d", netdev->name,
45 inet6_ntoa ( &miniroute->address ),
46 miniroute->prefix_len );
47 if ( miniroute->flags & IPV6_HAS_ROUTER )
48 printf ( " gw %s", inet6_ntoa ( &miniroute->router ) );
49 if ( ! ( miniroute->flags & IPV6_HAS_ADDRESS ) )
50 printf ( " (no address)" );
51 if ( ! netdev_is_open ( miniroute->netdev ) )
52 printf ( " (inaccessible)" );
57 /** IPv6 routing family */
58 struct routing_family ipv6_routing_family __routing_family ( ROUTING_IPV6 ) = {
59 .print = route_ipv6_print,