Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / ipxe / src / usr / route_ipv6.c
1 /*
2  * Copyright (C) 2013 Michael Brown <mbrown@fensystems.co.uk>.
3  *
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.
8  *
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.
13  *
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
17  * 02110-1301, USA.
18  */
19
20 FILE_LICENCE ( GPL2_OR_LATER );
21
22 #include <stdio.h>
23 #include <ipxe/netdevice.h>
24 #include <ipxe/ipv6.h>
25 #include <usr/route.h>
26
27 /** @file
28  *
29  * IPv6 routing management
30  *
31  */
32
33 /**
34  * Print IPv6 routing table
35  *
36  * @v netdev            Network device
37  */
38 static void route_ipv6_print ( struct net_device *netdev ) {
39         struct ipv6_miniroute *miniroute;
40
41         list_for_each_entry ( miniroute, &ipv6_miniroutes, list ) {
42                 if ( miniroute->netdev != netdev )
43                         continue;
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)" );
53                 printf ( "\n" );
54         }
55 }
56
57 /** IPv6 routing family */
58 struct routing_family ipv6_routing_family __routing_family ( ROUTING_IPV6 ) = {
59         .print = route_ipv6_print,
60 };