Lines Matching full:hop

771 /* Hop-by-hop hdr helper functions
775 * calipso_opt_update - Replaces socket's hop options with a new set
777 * @hop: new hop options
780 * Replaces @sk's hop options with @hop. @hop may be NULL to leave
781 * the socket with no hop options.
784 static int calipso_opt_update(struct sock *sk, struct ipv6_opt_hdr *hop) in calipso_opt_update() argument
788 txopts = ipv6_renew_options(sk, old, IPV6_HOPOPTS, hop); in calipso_opt_update()
830 * calipso_opt_find - Finds the CALIPSO option in an IPv6 hop options header
831 * @hop: the hop options header
840 * offsets within @hop of the start of padding before the first
850 static int calipso_opt_find(struct ipv6_opt_hdr *hop, unsigned int *start, in calipso_opt_find() argument
855 unsigned char *opt = (unsigned char *)hop; in calipso_opt_find()
857 opt_len = ipv6_optlen(hop); in calipso_opt_find()
858 offset = sizeof(*hop); in calipso_opt_find()
861 tlv_len = calipso_tlv_len(hop, offset); in calipso_opt_find()
886 *start = offset_s + calipso_tlv_len(hop, offset_s); in calipso_opt_find()
888 *start = sizeof(*hop); in calipso_opt_find()
890 *end = offset_e + calipso_tlv_len(hop, offset_e); in calipso_opt_find()
898 * calipso_opt_insert - Inserts a CALIPSO option into an IPv6 hop opt hdr
899 * @hop: the original hop options header
904 * Creates a new hop options header based on @hop with a
905 * CALIPSO option added to it. If @hop already contains a CALIPSO
907 * after any existing options. If @hop is NULL then the new header
912 calipso_opt_insert(struct ipv6_opt_hdr *hop, in calipso_opt_insert() argument
920 if (hop) { in calipso_opt_insert()
921 hop_len = ipv6_optlen(hop); in calipso_opt_insert()
922 ret_val = calipso_opt_find(hop, &start, &end); in calipso_opt_insert()
927 start = sizeof(*hop); in calipso_opt_insert()
936 if (start > sizeof(*hop)) in calipso_opt_insert()
937 memcpy(new, hop, start); in calipso_opt_insert()
952 memcpy((char *)new + buf_len, (char *)hop + end, hop_len - end); in calipso_opt_insert()
963 * @hop: the original header
967 * Creates a new header based on @hop without any CALIPSO option. If @hop
968 * doesn't contain a CALIPSO option it returns -ENOENT. If @hop contains
975 static int calipso_opt_del(struct ipv6_opt_hdr *hop, in calipso_opt_del() argument
981 ret_val = calipso_opt_find(hop, &start, &end); in calipso_opt_del()
985 hop_len = ipv6_optlen(hop); in calipso_opt_del()
986 if (start == sizeof(*hop) && end == hop_len) { in calipso_opt_del()
997 memcpy(*new, hop, start); in calipso_opt_del()
1002 memcpy((char *)*new + start + pad, (char *)hop + end, in calipso_opt_del()
1079 struct ipv6_opt_hdr *hop; in calipso_sock_getattr() local
1087 hop = txopts->hopopt; in calipso_sock_getattr()
1088 opt = (unsigned char *)hop; in calipso_sock_getattr()
1089 opt_len = ipv6_optlen(hop); in calipso_sock_getattr()
1090 offset = sizeof(*hop); in calipso_sock_getattr()
1092 len = calipso_tlv_len(hop, offset); in calipso_sock_getattr()
1304 struct ipv6_opt_hdr *hop; in calipso_skbuff_setattr() local
1311 hop = (struct ipv6_opt_hdr *)(ip6_hdr + 1); in calipso_skbuff_setattr()
1312 ret_val = calipso_opt_find(hop, &start, &end); in calipso_skbuff_setattr()
1348 hop = (struct ipv6_opt_hdr *)(ip6_hdr + 1); in calipso_skbuff_setattr()
1356 hop->hdrlen += len_delta / 8; in calipso_skbuff_setattr()
1358 memcpy((char *)hop + start, buf + (start & 3), new_end - start); in calipso_skbuff_setattr()
1359 calipso_pad_write((unsigned char *)hop, new_end, pad); in calipso_skbuff_setattr()