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.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. * You can also choose to distribute this program under the terms of
  20. * the Unmodified Binary Distribution Licence (as given in the file
  21. * COPYING.UBDL), provided that you have satisfied its requirements.
  22. */
  23. FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
  24. #include <stdio.h>
  25. #include <ipxe/netdevice.h>
  26. #include <ipxe/ipv6.h>
  27. #include <usr/route.h>
  28. /** @file
  29. *
  30. * IPv6 routing management
  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. list_for_each_entry ( miniroute, &ipv6_miniroutes, list ) {
  41. if ( miniroute->netdev != netdev )
  42. continue;
  43. printf ( "%s: %s/%d", netdev->name,
  44. inet6_ntoa ( &miniroute->address ),
  45. miniroute->prefix_len );
  46. if ( miniroute->flags & IPV6_HAS_ROUTER )
  47. printf ( " gw %s", inet6_ntoa ( &miniroute->router ) );
  48. if ( ! ( miniroute->flags & IPV6_HAS_ADDRESS ) )
  49. printf ( " (no address)" );
  50. if ( ! netdev_is_open ( miniroute->netdev ) )
  51. printf ( " (inaccessible)" );
  52. printf ( "\n" );
  53. }
  54. }
  55. /** IPv6 routing family */
  56. struct routing_family ipv6_routing_family __routing_family ( ROUTING_IPV6 ) = {
  57. .print = route_ipv6_print,
  58. };