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.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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/neighbour.h>
  22. #include <usr/neighmgmt.h>
  23. /** @file
  24. *
  25. * Neighbour management
  26. *
  27. */
  28. /**
  29. * Print neighbour table
  30. *
  31. */
  32. void nstat ( void ) {
  33. struct neighbour *neighbour;
  34. struct net_device *netdev;
  35. struct ll_protocol *ll_protocol;
  36. struct net_protocol *net_protocol;
  37. list_for_each_entry ( neighbour, &neighbours, list ) {
  38. netdev = neighbour->netdev;
  39. ll_protocol = netdev->ll_protocol;
  40. net_protocol = neighbour->net_protocol;
  41. printf ( "%s %s %s is %s %s", netdev->name, net_protocol->name,
  42. net_protocol->ntoa ( neighbour->net_dest ),
  43. ll_protocol->name,
  44. ( neighbour_has_ll_dest ( neighbour ) ?
  45. ll_protocol->ntoa ( neighbour->ll_dest ) :
  46. "(incomplete)" ) );
  47. if ( neighbour->discovery )
  48. printf ( " (%s)", neighbour->discovery->name );
  49. printf ( "\n" );
  50. }
  51. }