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

rarp.c 2.1KB

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