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

route.c 1.4KB

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