Lines Matching refs:ip

79 #include <netinet/ip.h>
119 struct ip *ip;
122 ip = mtod(m, struct ip *);
125 odst.s_addr = ip->ip_dst.s_addr;
131 ip = mtod(m, struct ip *);
134 if (odst.s_addr != ip->ip_dst.s_addr) {
137 if (in_localip(ip->ip_dst)) {
159 dst->sin_addr = ip->ip_dst;
220 struct ip *ip;
223 int hlen = sizeof (struct ip);
261 hlen = len; /* ip->ip_hl is updated above */
263 ip = mtod(m, struct ip *);
264 ip_len = ntohs(ip->ip_len);
265 ip_off = ntohs(ip->ip_off);
268 ip->ip_v = IPVERSION;
269 ip->ip_hl = hlen >> 2;
270 ip_fillid(ip);
273 hlen = ip->ip_hl << 2;
292 dst->sin_addr = ip->ip_dst;
315 dst->sin_addr.s_addr != ip->ip_dst.s_addr)) {
335 ip->ip_dst.s_addr = INADDR_BROADCAST;
336 dst->sin_addr = ip->ip_dst;
338 ip->ip_ttl = 1;
350 ip->ip_ttl = 1;
353 } else if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr)) &&
371 ntohl(ip->ip_src.s_addr ^ ip->ip_dst.s_addr),
421 if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr))) {
433 ip->ip_ttl = imo->imo_multicast_ttl;
435 ip->ip_src.s_addr =
440 ip->ip_ttl = IP_DEFAULT_MULTICAST_TTL;
455 if (ip->ip_src.s_addr == INADDR_ANY) {
458 ip->ip_src = IA_SIN(ia)->sin_addr;
494 ip_mforward(ip, ifp, m, imo) != 0) {
510 if (ip->ip_ttl == 0 || ifp->if_flags & IFF_LOOPBACK) {
522 if (ip->ip_src.s_addr == INADDR_ANY) {
525 ip->ip_src = IA_SIN(ia)->sin_addr;
571 ip = mtod(m, struct ip *);
572 hlen = ip->ip_hl << 2;
582 ip = mtod(m, struct ip *);
591 ip = mtod(m, struct ip *);
601 if (IN_LOOPBACK(ntohl(ip->ip_dst.s_addr)) ||
602 IN_LOOPBACK(ntohl(ip->ip_src.s_addr))) {
617 sctp_delayed_cksum(m, (uint32_t)(ip->ip_hl << 2));
628 ip->ip_sum = 0;
630 ip->ip_sum = in_cksum(m, hlen);
658 IP_PROBE(send, NULL, NULL, ip, ifp, ip, NULL);
691 error = ip_fragment(ip, &m, mtu, ifp->if_hwassist);
710 IP_PROBE(send, NULL, NULL, mtod(m, struct ip *), ifp,
711 mtod(m, struct ip *), NULL);
763 ip_fragment(struct ip *ip, struct mbuf **m_frag, int mtu,
767 int hlen = ip->ip_hl << 2;
776 ip_len = ntohs(ip->ip_len);
777 ip_off = ntohs(ip->ip_off);
827 if ((newlen + sizeof (struct ip)) > mtu) {
850 struct ip *mhip; /* ip header on the fragment */
852 int mhlen = sizeof (struct ip);
879 mhip = mtod(m, struct ip *);
880 *mhip = *ip;
881 if (hlen > sizeof (struct ip)) {
882 mhlen = ip_optcopy(ip, mhip) + sizeof (struct ip);
922 ip->ip_len = htons((u_short)m0->m_pkthdr.len);
923 ip->ip_off = htons(ip_off | IP_MF);
924 ip->ip_sum = 0;
926 ip->ip_sum = in_cksum(m0, hlen);
938 struct ip *ip;
942 ip = mtod(m, struct ip *);
943 offset = ip->ip_hl << 2 ;
959 cklen = ntohs(ip->ip_len);
1478 struct ip *ip;
1501 ip = mtod(copym, struct ip *);
1502 ip->ip_sum = 0;
1503 ip->ip_sum = in_cksum(copym, hlen);