您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

route.c 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Copyright (C) 2007 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., 675 Mass Ave, Cambridge, MA 02139, USA.
  17. */
  18. #include <stdio.h>
  19. #include <gpxe/netdevice.h>
  20. #include <gpxe/ip.h>
  21. #include <usr/route.h>
  22. /** @file
  23. *
  24. * Routing table management
  25. *
  26. */
  27. void route ( void ) {
  28. struct ipv4_miniroute *miniroute;
  29. list_for_each_entry ( miniroute, &ipv4_miniroutes, list ) {
  30. printf ( "%s: %s/", miniroute->netdev->name,
  31. inet_ntoa ( miniroute->address ) );
  32. printf ( "%s", inet_ntoa ( miniroute->netmask ) );
  33. if ( miniroute->gateway.s_addr != INADDR_NONE )
  34. printf ( " gw %s", inet_ntoa ( miniroute->gateway ) );
  35. if ( ! ( miniroute->netdev->state & NETDEV_OPEN ) )
  36. printf ( " (inaccessible)" );
  37. printf ( "\n" );
  38. }
  39. }