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.

65 lines
2.6 KiB

  1. From f9e62248f252accb0609243958fb51f0f99a5bf3 Mon Sep 17 00:00:00 2001
  2. From: Ricardo Salveti <ricardo@foundries.io>
  3. Date: Mon, 1 Oct 2018 22:45:17 -0300
  4. Subject: [PATCH 2/2] packet: rename offset_to_ptr to skb_offset_to_ptr to
  5. avoid conflicts with newer kernel
  6. Rename offset_to_ptr to skb_offset_to_ptr to avoid definition conflict
  7. when building jool against linux >= 4.19.
  8. Fixes:
  9. | mod/stateful/../common/packet.c:73:14: error: conflicting types for 'offset_to_ptr'
  10. | static void *offset_to_ptr(struct sk_buff *skb, unsigned int offset)
  11. | ^~~~~~~~~~~~~
  12. | In file included from kernel-source/include/linux/export.h:45,
  13. | from kernel-source/include/linux/linkage.h:7,
  14. | from kernel-source/include/linux/kernel.h:7,
  15. | from kernel-source/include/linux/skbuff.h:17,
  16. | from mod/stateful/../../include/nat64/mod/common/packet.h:81,
  17. | from mod/stateful/../common/packet.c:1:
  18. | kernel-source/include/linux/compiler.h:297:21: note: previous definition of 'offset_to_ptr' was here
  19. | static inline void *offset_to_ptr(const int *off)
  20. | ^~~~~~~~~~~~~
  21. Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
  22. ---
  23. mod/common/packet.c | 8 ++++----
  24. 1 file changed, 4 insertions(+), 4 deletions(-)
  25. diff --git a/mod/common/packet.c b/mod/common/packet.c
  26. index 9b4fbcd6..1b094fcc 100644
  27. --- a/mod/common/packet.c
  28. +++ b/mod/common/packet.c
  29. @@ -70,7 +70,7 @@ static int inhdr4(struct sk_buff *skb, const char *msg)
  30. return -EINVAL;
  31. }
  32. -static void *offset_to_ptr(struct sk_buff *skb, unsigned int offset)
  33. +static void *skb_offset_to_ptr(struct sk_buff *skb, unsigned int offset)
  34. {
  35. return ((void *) skb->data) + offset;
  36. }
  37. @@ -368,9 +368,9 @@ int pkt_init_ipv6(struct packet *pkt, struct sk_buff *skb)
  38. pkt->l4_proto = meta.l4_proto;
  39. pkt->is_inner = 0;
  40. pkt->is_hairpin = false;
  41. - pkt->hdr_frag = meta.has_frag_hdr ? offset_to_ptr(skb, meta.frag_offset) : NULL;
  42. + pkt->hdr_frag = meta.has_frag_hdr ? skb_offset_to_ptr(skb, meta.frag_offset) : NULL;
  43. skb_set_transport_header(skb, meta.l4_offset);
  44. - pkt->payload = offset_to_ptr(skb, meta.payload_offset);
  45. + pkt->payload = skb_offset_to_ptr(skb, meta.payload_offset);
  46. pkt->original_pkt = pkt;
  47. return 0;
  48. @@ -530,7 +530,7 @@ int pkt_init_ipv4(struct packet *pkt, struct sk_buff *skb)
  49. pkt->is_hairpin = false;
  50. pkt->hdr_frag = NULL;
  51. skb_set_transport_header(skb, meta.l4_offset);
  52. - pkt->payload = offset_to_ptr(skb, meta.payload_offset);
  53. + pkt->payload = skb_offset_to_ptr(skb, meta.payload_offset);
  54. pkt->original_pkt = pkt;
  55. return 0;
  56. --
  57. 2.19.1