You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

route_ipv6.c 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. FILE_LICENCE ( GPL2_OR_LATER );
  20. #include <stdio.h>
  21. #include <ipxe/netdevice.h>
  22. #include <ipxe/ipv6.h>
  23. #include <usr/route.h>
  24. /** @file
  25. *
  26. * IPv6 routing management
  27. *
  28. */
  29. /**
  30. * Print IPv6 routing table
  31. *
  32. * @v netdev Network device
  33. */
  34. static void route_ipv6_print ( struct net_device *netdev ) {
  35. struct ipv6_miniroute *miniroute;
  36. list_for_each_entry ( miniroute, &ipv6_miniroutes, list ) {
  37. if ( miniroute->netdev != netdev )
  38. continue;
  39. printf ( "%s: %s/%d", netdev->name,
  40. inet6_ntoa ( &miniroute->address ),
  41. miniroute->prefix_len );
  42. if ( miniroute->flags & IPV6_HAS_ROUTER )
  43. printf ( " gw %s", inet6_ntoa ( &miniroute->router ) );
  44. if ( ! ( miniroute->flags & IPV6_HAS_ADDRESS ) )
  45. printf ( " (no address)" );
  46. if ( ! netdev_is_open ( miniroute->netdev ) )
  47. printf ( " (inaccessible)" );
  48. printf ( "\n" );
  49. }
  50. }
  51. /** IPv6 routing family */
  52. struct routing_family ipv6_routing_family __routing_family ( ROUTING_IPV6 ) = {
  53. .print = route_ipv6_print,
  54. };