Lines Matching defs:hop

764 /* Hop-by-hop hdr helper functions
768 * calipso_opt_update - Replaces socket's hop options with a new set
770 * @hop: new hop options
773 * Replaces @sk's hop options with @hop. @hop may be NULL to leave
774 * the socket with no hop options.
777 static int calipso_opt_update(struct sock *sk, struct ipv6_opt_hdr *hop)
781 txopts = ipv6_renew_options(sk, old, IPV6_HOPOPTS, hop);
823 * calipso_opt_find - Finds the CALIPSO option in an IPv6 hop options header
824 * @hop: the hop options header
833 * offsets within @hop of the start of padding before the first
843 static int calipso_opt_find(struct ipv6_opt_hdr *hop, unsigned int *start,
848 unsigned char *opt = (unsigned char *)hop;
850 opt_len = ipv6_optlen(hop);
851 offset = sizeof(*hop);
854 tlv_len = calipso_tlv_len(hop, offset);
879 *start = offset_s + calipso_tlv_len(hop, offset_s);
881 *start = sizeof(*hop);
883 *end = offset_e + calipso_tlv_len(hop, offset_e);
891 * calipso_opt_insert - Inserts a CALIPSO option into an IPv6 hop opt hdr
892 * @hop: the original hop options header
897 * Creates a new hop options header based on @hop with a
898 * CALIPSO option added to it. If @hop already contains a CALIPSO
900 * after any existing options. If @hop is NULL then the new header
905 calipso_opt_insert(struct ipv6_opt_hdr *hop,
913 if (hop) {
914 hop_len = ipv6_optlen(hop);
915 ret_val = calipso_opt_find(hop, &start, &end);
920 start = sizeof(*hop);
929 if (start > sizeof(*hop))
930 memcpy(new, hop, start);
945 memcpy((char *)new + buf_len, (char *)hop + end, hop_len - end);
956 * @hop: the original header
960 * Creates a new header based on @hop without any CALIPSO option. If @hop
961 * doesn't contain a CALIPSO option it returns -ENOENT. If @hop contains
968 static int calipso_opt_del(struct ipv6_opt_hdr *hop,
974 ret_val = calipso_opt_find(hop, &start, &end);
978 hop_len = ipv6_optlen(hop);
979 if (start == sizeof(*hop) && end == hop_len) {
990 memcpy(*new, hop, start);
995 memcpy((char *)*new + start + pad, (char *)hop + end,
1072 struct ipv6_opt_hdr *hop;
1080 hop = txopts->hopopt;
1081 opt = (unsigned char *)hop;
1082 opt_len = ipv6_optlen(hop);
1083 offset = sizeof(*hop);
1085 len = calipso_tlv_len(hop, offset);
1297 struct ipv6_opt_hdr *hop;
1304 hop = (struct ipv6_opt_hdr *)(ip6_hdr + 1);
1305 ret_val = calipso_opt_find(hop, &start, &end);
1341 hop = (struct ipv6_opt_hdr *)(ip6_hdr + 1);
1349 hop->hdrlen += len_delta / 8;
1351 memcpy((char *)hop + start, buf + (start & 3), new_end - start);
1352 calipso_pad_write((unsigned char *)hop, new_end, pad);