You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

rarp.c 1.7KB

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