Lines Matching refs:hop

767 /* Hop-by-hop hdr helper functions
771 * calipso_opt_update - Replaces socket's hop options with a new set
773 * @hop: new hop options
776 * Replaces @sk's hop options with @hop. @hop may be NULL to leave
777 * the socket with no hop options.
780 static int calipso_opt_update(struct sock *sk, struct ipv6_opt_hdr *hop)
784 txopts = ipv6_renew_options(sk, old, IPV6_HOPOPTS, hop);
826 * calipso_opt_find - Finds the CALIPSO option in an IPv6 hop options header
827 * @hop: the hop options header
836 * offsets within @hop of the start of padding before the first
846 static int calipso_opt_find(struct ipv6_opt_hdr *hop, unsigned int *start,
851 unsigned char *opt = (unsigned char *)hop;
853 opt_len = ipv6_optlen(hop);
854 offset = sizeof(*hop);
857 tlv_len = calipso_tlv_len(hop, offset);
882 *start = offset_s + calipso_tlv_len(hop, offset_s);
884 *start = sizeof(*hop);
886 *end = offset_e + calipso_tlv_len(hop, offset_e);
894 * calipso_opt_insert - Inserts a CALIPSO option into an IPv6 hop opt hdr
895 * @hop: the original hop options header
900 * Creates a new hop options header based on @hop with a
901 * CALIPSO option added to it. If @hop already contains a CALIPSO
903 * after any existing options. If @hop is NULL then the new header
908 calipso_opt_insert(struct ipv6_opt_hdr *hop,
916 if (hop) {
917 hop_len = ipv6_optlen(hop);
918 ret_val = calipso_opt_find(hop, &start, &end);
923 start = sizeof(*hop);
932 if (start > sizeof(*hop))
933 memcpy(new, hop, start);
948 memcpy((char *)new + buf_len, (char *)hop + end, hop_len - end);
959 * @hop: the original header
963 * Creates a new header based on @hop without any CALIPSO option. If @hop
964 * doesn't contain a CALIPSO option it returns -ENOENT. If @hop contains
971 static int calipso_opt_del(struct ipv6_opt_hdr *hop,
977 ret_val = calipso_opt_find(hop, &start, &end);
981 hop_len = ipv6_optlen(hop);
982 if (start == sizeof(*hop) && end == hop_len) {
993 memcpy(*new, hop, start);
998 memcpy((char *)*new + start + pad, (char *)hop + end,
1075 struct ipv6_opt_hdr *hop;
1083 hop = txopts->hopopt;
1084 opt = (unsigned char *)hop;
1085 opt_len = ipv6_optlen(hop);
1086 offset = sizeof(*hop);
1088 len = calipso_tlv_len(hop, offset);
1300 struct ipv6_opt_hdr *hop;
1307 hop = (struct ipv6_opt_hdr *)(ip6_hdr + 1);
1308 ret_val = calipso_opt_find(hop, &start, &end);
1344 hop = (struct ipv6_opt_hdr *)(ip6_hdr + 1);
1352 hop->hdrlen += len_delta / 8;
1354 memcpy((char *)hop + start, buf + (start & 3), new_end - start);
1355 calipso_pad_write((unsigned char *)hop, new_end, pad);