Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

rarp.c 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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., 51 Franklin Street, Fifth Floor, Boston, MA
  17. * 02110-1301, USA.
  18. */
  19. FILE_LICENCE ( GPL2_OR_LATER );
  20. #include <stdint.h>
  21. #include <byteswap.h>
  22. #include <ipxe/netdevice.h>
  23. #include <ipxe/iobuf.h>
  24. #include <ipxe/if_ether.h>
  25. #include <ipxe/rarp.h>
  26. /** @file
  27. *
  28. * Reverse Address Resolution Protocol
  29. *
  30. */
  31. /**
  32. * Process incoming ARP packets
  33. *
  34. * @v iobuf I/O buffer
  35. * @v netdev Network device
  36. * @v ll_dest Link-layer destination address
  37. * @v ll_source Link-layer source address
  38. * @v flags Packet flags
  39. * @ret rc Return status code
  40. *
  41. * This is a dummy method which simply discards RARP packets.
  42. */
  43. static int rarp_rx ( struct io_buffer *iobuf,
  44. struct net_device *netdev __unused,
  45. const void *ll_dest __unused,
  46. const void *ll_source __unused,
  47. unsigned int flags __unused ) {
  48. free_iob ( iobuf );
  49. return 0;
  50. }
  51. /**
  52. * Transcribe RARP address
  53. *
  54. * @v net_addr RARP address
  55. * @ret string "<RARP>"
  56. *
  57. * This operation is meaningless for the RARP protocol.
  58. */
  59. static const char * rarp_ntoa ( const void *net_addr __unused ) {
  60. return "<RARP>";
  61. }
  62. /** RARP protocol */
  63. struct net_protocol rarp_protocol __net_protocol = {
  64. .name = "RARP",
  65. .net_proto = htons ( ETH_P_RARP ),
  66. .rx = rarp_rx,
  67. .ntoa = rarp_ntoa,
  68. };