Lines Matching defs:ipha
1332 ipha_t *ipha; /* Outer header */
1345 ipha = (ipha_t *)mp->b_rptr;
1358 ipha = ip_pullup(mp, ip_hdr_length + ICMPH_SIZE, ira);
1359 if (ipha == NULL) {
1430 ipha = (ipha_t *)mp->b_rptr;
1435 icmp_send_reply_v4(mp, ipha, icmph, ira);
1469 ipha = ip_pullup(mp, len_needed, ira);
1470 if (ipha == NULL) {
1492 ipha = (ipha_t *)mp->b_rptr;
1505 icmp_send_reply_v4(mp, ipha, icmph, ira);
1529 ipha = ip_pullup(mp, len_needed, ira);
1530 if (ipha == NULL) {
1553 ipha = (ipha_t *)mp->b_rptr;
1562 ipif = ipif_lookup_addr(ipha->ipha_dst, ill, zoneid, ipst);
1565 ipif = ipif_lookup_remote(ill, ipha->ipha_src, zoneid);
1575 icmp_send_reply_v4(mp, ipha, icmph, ira);
1641 ipha = (ipha_t *)mp->b_rptr;
1650 icmp_redirect_v4(mp, ipha, icmph, ira);
1672 icmp_send_reply_v4(mblk_t *mp, ipha_t *ipha, icmph_t *icmph,
1684 ipha->ipha_ttl = ipst->ips_ip_def_ttl;
1689 tmp = ipha->ipha_src;
1690 ipha->ipha_src = ipha->ipha_dst;
1691 ipha->ipha_dst = tmp;
1693 ipha->ipha_ident = 0;
1694 if (!IS_SIMPLE_IPH(ipha))
1695 icmp_options_update(ipha);
1715 if (!ipsec_in_to_out(ira, &ixas, mp, ipha, NULL)) {
1726 ipha->ipha_src = INADDR_ANY;
1732 ipha->ipha_fragment_offset_and_flags |= IPH_DF_HTONS;
1756 ipha_t *ipha; /* Inner IP header */
1758 ipha = (ipha_t *)&icmph[1];
1759 if ((uchar_t *)ipha + IP_SIMPLE_HDR_LENGTH > mp->b_wptr)
1762 hdr_length = IPH_HDR_LENGTH(ipha);
1764 if ((IPH_HDR_VERSION(ipha) != IPV4_VERSION))
1770 if ((uchar_t *)ipha + hdr_length > mp->b_wptr)
1782 switch (ipha->ipha_protocol) {
1788 if ((uchar_t *)ipha + hdr_length + ICMP_MIN_TP_HDR_LEN >
1799 if ((uchar_t *)ipha + hdr_length + ICMP_MIN_TP_HDR_LEN >
1803 tcpha = (tcpha_t *)((uchar_t *)ipha + hdr_length);
1804 connp = ipcl_tcp_lookup_reversed_ipv4(ipha, tcpha, TCPS_LISTEN,
1822 if ((uchar_t *)ipha + hdr_length + ICMP_MIN_TP_HDR_LEN >
1830 if ((uchar_t *)ipha + hdr_length + sizeof (ipha_t) >
1882 ipha_t *ipha;
1885 ipha = (ipha_t *)&icmph[1];
1890 hdr_length = IPH_HDR_LENGTH(ipha);
1896 dst = ip_get_dst(ipha);
1926 length = ntohs(ipha->ipha_length);
1990 icmp_inbound_self_encap_error_v4(mblk_t *mp, ipha_t *ipha, ipha_t *in_ipha)
2009 bcopy((uchar_t *)in_ipha, (uchar_t *)ipha, length);
2012 mp->b_wptr -= (uchar_t *)in_ipha - (uchar_t *)ipha;
2021 * valid association. ipha in the code below points to the
2076 ipha_t *ipha; /* Inner IP header */
2086 ipha = (ipha_t *)&icmph[1];
2087 ASSERT((uchar_t *)&ipha[1] <= mp->b_wptr);
2090 hdr_length = IPH_HDR_LENGTH(ipha);
2091 ira->ira_protocol = ipha->ipha_protocol;
2095 * addresses reversed to do fanout/classification because the ipha in
2098 ripha.ipha_src = ipha->ipha_dst;
2099 ripha.ipha_dst = ipha->ipha_src;
2100 ripha.ipha_protocol = ipha->ipha_protocol;
2101 ripha.ipha_version_and_hdr_length = ipha->ipha_version_and_hdr_length;
2104 ripha.ipha_protocol, ntohl(ipha->ipha_src),
2105 ntohl(ipha->ipha_dst),
2108 switch (ipha->ipha_protocol) {
2110 up = (uint16_t *)((uchar_t *)ipha + hdr_length);
2128 tcpha = (tcpha_t *)((uchar_t *)ipha + hdr_length);
2129 connp = ipcl_tcp_lookup_reversed_ipv4(ipha, tcpha, TCPS_LISTEN,
2137 ipha, NULL, ira);
2164 up = (uint16_t *)((uchar_t *)ipha + hdr_length);
2181 if (ipha->ipha_protocol == IPPROTO_ESP)
2206 ipha = (ipha_t *)mp->b_rptr;
2207 hdr_length = IPH_HDR_LENGTH(ipha);
2230 in_ipha = (ipha_t *)((uchar_t *)ipha + hdr_length);
2238 if (in_ipha->ipha_src == ipha->ipha_src &&
2239 in_ipha->ipha_dst == ipha->ipha_dst) {
2241 mp = icmp_inbound_self_encap_error_v4(mp, ipha,
2265 ipha = (ipha_t *)mp->b_rptr;
2266 hdr_length = IPH_HDR_LENGTH(ipha);
2278 if (ipha->ipha_protocol == IPPROTO_ENCAP) {
2329 ipoptp_first(ipoptp_t *optp, ipha_t *ipha)
2333 totallen = ipha->ipha_version_and_hdr_length -
2336 optp->ipoptp_next = (uint8_t *)(&ipha[1]);
2565 icmp_options_update(ipha_t *ipha)
2574 src = ipha->ipha_src;
2575 dst = ipha->ipha_dst;
2577 for (optval = ipoptp_first(&opts, ipha);
2603 bcopy(&ipha->ipha_dst, (char *)opt + off2, IP_ADDR_LEN);
2604 bcopy(&dst, &ipha->ipha_dst, IP_ADDR_LEN);
2627 icmp_redirect_v4(mblk_t *mp, ipha_t *ipha, icmph_t *icmph, ip_recv_attr_t *ira)
2637 src = ipha->ipha_src;
2780 ipha_t *ipha;
2789 ipha = (ipha_t *)mp->b_rptr;
2810 if (!ipsec_in_to_out(ira, &ixas, mp, ipha, NULL)) {
2824 dst = ipha->ipha_src;
2831 ire = ire_ftable_lookup_v4(ipha->ipha_dst, 0, 0,
2836 src = ipha->ipha_dst;
2847 len_needed = IPH_HDR_LENGTH(ipha);
2848 if (ipha->ipha_protocol == IPPROTO_ENCAP ||
2849 ipha->ipha_protocol == IPPROTO_IPV6) {
2856 ipha = (ipha_t *)mp->b_rptr;
2858 if (ipha->ipha_protocol == IPPROTO_ENCAP) {
2859 len_needed += IPH_HDR_LENGTH(((uchar_t *)ipha +
2862 ip6_t *ip6h = (ip6_t *)((uchar_t *)ipha + len_needed);
2864 ASSERT(ipha->ipha_protocol == IPPROTO_IPV6);
2892 ipha = (ipha_t *)mp->b_rptr;
2893 mp1->b_wptr = (uchar_t *)ipha + (sizeof (icmp_ipha) + len);
2894 *ipha = icmp_ipha;
2895 ipha->ipha_src = src;
2896 ipha->ipha_dst = dst;
2897 ipha->ipha_ttl = ipst->ips_ip_def_ttl;
2903 ipha->ipha_length = htons((uint16_t)msg_len);
2904 icmph = (icmph_t *)&ipha[1];
2979 ipha_t *ipha;
2984 ipha = (ipha_t *)mp->b_rptr;
2985 if (ip_csum_hdr(ipha)) {
2991 if (ip_type_v4(ipha->ipha_dst, ipst) == IRE_BROADCAST ||
2992 ip_type_v4(ipha->ipha_src, ipst) == IRE_BROADCAST ||
2993 CLASSD(ipha->ipha_dst) ||
2994 CLASSD(ipha->ipha_src) ||
2995 (ntohs(ipha->ipha_fragment_offset_and_flags) & IPH_OFFSET)) {
3001 if (ipha->ipha_protocol == IPPROTO_ICMP) {
3006 len_needed = IPH_HDR_LENGTH(ipha) + ICMPH_SIZE;
3013 ipha = (ipha_t *)mp->b_rptr;
3016 (&((char *)ipha)[IPH_HDR_LENGTH(ipha)]);
3057 ip_send_potential_redirect_v4(mblk_t *mp, ipha_t *ipha, ire_t *ire,
3083 ip_source_routed(ipha, ipst))
3109 src = ipha->ipha_src;
4828 ipha_t *ipha;
4844 ipha = (ipha_t *)mp->b_rptr;
4846 mp = ipsec_check_global_policy(mp, NULL, ipha, NULL, ira, ns);
4865 ipha->ipha_hdr_checksum = 0;
4866 ipha->ipha_hdr_checksum = ip_csum_hdr(ipha);
4902 ipha_t *ipha;
4904 ipha = (ipha_t *)mp->b_rptr;
4906 ASSERT(IPH_HDR_VERSION(ipha) == IP_VERSION);
4910 ASSERT(IPH_HDR_VERSION(ipha) == IPV6_VERSION);
4923 ip_fanout_proto_conn(conn_t *connp, mblk_t *mp, ipha_t *ipha, ip6_t *ip6h,
4959 mp = ipsec_check_inbound_policy(mp, connp, ipha,
5013 ip_fanout_proto_v4(mblk_t *mp, ipha_t *ipha, ip_recv_attr_t *ira)
5022 laddr = ipha->ipha_dst;
5030 if (IPCL_PROTO_MATCH(connp, ira, ipha) &&
5058 if (IPCL_PROTO_MATCH(connp, ira, ipha) &&
5096 ip_fanout_proto_conn(connp, mp, ipha, NULL, ira);
5119 ipha_t *ipha;
5127 ipha = (ipha_t *)mp->b_rptr;
5154 ipha = (ipha_t *)mp->b_rptr;
5162 ipha->ipha_protocol = IPPROTO_ESP;
5168 ipha->ipha_length = htons(ira->ira_pktlen);
5169 ipha->ipha_hdr_checksum = 0;
5176 ASSERT((uint8_t *)ipha == orptr);
5186 ipha = (ipha_t *)(orptr + shift);
5190 ip_fanout_v4(mp, ipha, ira);
5203 ip_fanout_udp_conn(conn_t *connp, mblk_t *mp, ipha_t *ipha, ip6_t *ip6h,
5225 mp = ipsec_check_inbound_policy(mp, connp, ipha,
5273 ip_fanout_udp_multi_v4(mblk_t *mp, ipha_t *ipha, uint16_t lport, uint16_t fport,
5286 laddr = ipha->ipha_dst;
5287 faddr = ipha->ipha_src;
5300 conn_wantpacket(connp, ira, ipha) &&
5322 conn_wantpacket(connp, ira, ipha) &&
5359 ip_fanout_udp_conn(connp, mp, ipha, NULL, ira);
5374 IN6_IPADDR_TO_V4MAPPED(ipha->ipha_src, &v6faddr);
5388 conn_wantpacket(connp, ira, ipha) &&
5406 ip_fanout_proto_v4(mp, ipha, ira);
5437 conn_wantpacket(connp, ira, ipha) &&
5474 ip_fanout_udp_conn(connp, mp, ipha, NULL, ira);
5487 ip_find_hdr_v4(ipha_t *ipha, ip_pkt_t *ipp, boolean_t allocate)
5495 ipp->ipp_hoplimit = ipha->ipha_ttl;
5496 ipp->ipp_type_of_service = ipha->ipha_type_of_service;
5497 IN6_IPADDR_TO_V4MAPPED(ipha->ipha_dst, &ipp->ipp_addr);
5502 totallen = ipha->ipha_version_and_hdr_length -
5527 opt = (uchar_t *)&ipha[1];
5623 totallen = ipha->ipha_version_and_hdr_length -
5626 opt = (uchar_t *)&ipha[1];
5709 ip_massage_options(ipha_t *ipha, netstack_t *ns)
5720 dst = ipha->ipha_dst;
5721 for (optval = ipoptp_first(&opts, ipha);
5766 ipha->ipha_dst = dst;
7014 ip_input_fragment(mblk_t *mp, ipha_t *ipha, ip_recv_attr_t *ira)
7019 uint8_t proto = ipha->ipha_protocol;
7050 if ((frag_offset_flags = ntohs(ipha->ipha_fragment_offset_and_flags) &
7072 offset = ((uchar_t *)ipha + IPH_HDR_LENGTH(ipha)) - mp->b_rptr;
7103 ident = ipha->ipha_ident;
7105 src = ipha->ipha_src;
7106 dst = ipha->ipha_dst;
7107 hdr_length = IPH_HDR_LENGTH(ipha);
7108 end = ntohs(ipha->ipha_length) - hdr_length;
7117 ecn_info = (ipha->ipha_type_of_service & 0x3);
7441 ipha = (ipha_t *)mp->b_rptr;
7443 ipha->ipha_length = htons((uint16_t)packet_size);
7445 ipha->ipha_fragment_offset_and_flags = 0;
7447 ipha->ipha_type_of_service &= 0xFC;
7448 ipha->ipha_type_of_service |= ecn_info;
7452 ira->ira_ip_hdr_length = IPH_HDR_LENGTH(ipha);
7634 ip_check_optlen(mblk_t *mp, ipha_t *ipha, uint_t opt_len, uint_t pkt_len,
7641 if (IPH_HDR_VERSION(ipha) != IPV4_VERSION) {
8984 ip_forward_options(mblk_t *mp, ipha_t *ipha, ill_t *dst_ill,
8998 dst = ipha->ipha_dst;
8999 for (optval = ipoptp_first(&opts, ipha);
9060 ipha->ipha_dst = dst;
9236 ip_input_local_options(mblk_t *mp, ipha_t *ipha, ip_recv_attr_t *ira)
9251 for (optval = ipoptp_first(&opts, ipha);
9302 if (ip_select_source_v4(ill, INADDR_ANY, ipha->ipha_dst,
9354 ipha->ipha_dst, INADDR_ANY, ALL_ZONES, ipst,
9394 ip_input_options(ipha_t *ipha, ipaddr_t dst, mblk_t *mp,
9407 for (optval = ipoptp_first(&opts, ipha);
9428 code = (char *)&ipha->ipha_dst -
9429 (char *)ipha;
9442 (char *)ipha;
9502 (char *)ipha;
9512 code = (char *)&opt[IPOPT_OLEN] - (char *)ipha;
9520 (char *)ipha;
9534 (char *)ipha;
9554 code = (char *)&opt[IPOPT_OFFSET] - (char *)ipha;
11457 ip_source_routed(ipha_t *ipha, ip_stack_t *ipst)
11465 if (IS_SIMPLE_IPH(ipha)) {
11469 dst = ipha->ipha_dst;
11470 for (optval = ipoptp_first(&opts, ipha);
11574 ip_get_dst(ipha_t *ipha)
11583 dst = ipha->ipha_dst;
11585 if (IS_SIMPLE_IPH(ipha))
11588 for (optval = ipoptp_first(&opts, ipha);
11630 ipha_t *ipha;
11660 ipha = (ipha_t *)mp->b_rptr;
11661 ASSERT(ntohs(ipha->ipha_length) == pkt_len);
11662 frag_flag = ntohs(ipha->ipha_fragment_offset_and_flags) & IPH_DF;
11668 offset = ntohs(ipha->ipha_fragment_offset_and_flags) & IPH_OFFSET;
11671 if (((max_frag - ntohs(ipha->ipha_length)) & ~7) < 8) {
11679 hdr_len = IPH_HDR_LENGTH(ipha);
11680 ipha->ipha_hdr_checksum = 0;
11689 hdr_mp = ip_fragment_copyhdr((uchar_t *)ipha, hdr_len, offset, ipst,
11700 ipha->ipha_fragment_offset_and_flags = htons((uint16_t)i1);
11704 ip_data_end = offset + ntohs(ipha->ipha_length) - hdr_len;
11709 ipha->ipha_length = htons((uint16_t)i1);
11715 ipha->ipha_hdr_checksum = ip_csum_hdr(ipha);
11788 ipha = (ipha_t *)mp->b_rptr;
11822 ipha = (ipha_t *)mp->b_rptr;
11825 ntohs(ipha->ipha_fragment_offset_and_flags) &
11831 ipha->ipha_fragment_offset_and_flags = htons(offset_and_flags);
11835 ipha->ipha_length = htons(ip_len);
11841 ipha->ipha_hdr_checksum = ip_csum_hdr(ipha);
11938 ip_output_local_options(ipha_t *ipha, ip_stack_t *ipst)
11948 for (optval = ipoptp_first(&opts, ipha);
12163 ipha_t *ipha = (ipha_t *)mp->b_rptr;
12165 ASSERT(IPH_HDR_VERSION(ipha) == IPV4_VERSION);
12166 pktlen = ntohs(ipha->ipha_length);
12240 ipha_t *ipha = (ipha_t *)mp->b_rptr;
12242 ASSERT(IPH_HDR_VERSION(ipha) == IPV4_VERSION);
12243 ira->ira_pktlen = ntohs(ipha->ipha_length);
12244 ira->ira_ip_hdr_length = IPH_HDR_LENGTH(ipha);
12245 ira->ira_protocol = ipha->ipha_protocol;
12247 ip_fanout_v4(mp, ipha, ira);
12974 ip_output_options(mblk_t *mp, ipha_t *ipha, ip_xmit_attr_t *ixa, ill_t *ill)
12988 dst = ipha->ipha_dst;
12989 for (optval = ipoptp_first(&opts, ipha);
13004 (char *)ipha;
13034 (char *)ipha;
13044 code = (char *)&opt[IPOPT_OLEN] - (char *)ipha;
13052 (char *)ipha;
13066 (char *)ipha;
13085 code = (char *)&opt[IPOPT_OFFSET] - (char *)ipha;
13421 conn_wantpacket(conn_t *connp, ip_recv_attr_t *ira, ipha_t *ipha)
13428 dst = ipha->ipha_dst;
13429 src = ipha->ipha_src;
13460 if (ipha->ipha_protocol == IPPROTO_PIM ||
13461 ipha->ipha_protocol == IPPROTO_RSVP)
13571 ipha_t *ipha = (ipha_t *)buf;
13575 ipha->ipha_type_of_service = ipp->ipp_type_of_service;
13576 ipha->ipha_length = 0; /* Caller will set later */
13577 ipha->ipha_ident = 0;
13578 ipha->ipha_fragment_offset_and_flags = 0;
13579 ipha->ipha_ttl = ipp->ipp_unicast_hops;
13580 ipha->ipha_protocol = protocol;
13581 ipha->ipha_hdr_checksum = 0;
13585 ipha->ipha_src = ipp->ipp_addr_v4;
13587 cp = (uint8_t *)&ipha[1];
13604 ipha->ipha_version_and_hdr_length =
14292 ip_fanout_sctp_raw(mblk_t *mp, ipha_t *ipha, ip6_t *ip6h, uint32_t ports,
14307 connp = ipcl_classify_raw(mp, IPPROTO_SCTP, ports, ipha, ip6h,
14336 mp = ipsec_check_inbound_policy(mp, connp, ipha,
14447 ipha_t *ipha = (ipha_t *)mp->b_rptr;
14457 NULL, ill, ipha, mp, mp, 0, ipst, error);
14485 void_ip_t *, ipha, __dtrace_ipsr_ill_t *, ill,
14486 ipha_t *, ipha, ip6_t *, NULL, int, 0);