Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

rarp.c 1.8KB

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