Lines Matching refs:ip

73 #include <netinet/ip.h>
125 int (*ip_mforward)(struct ip *, struct ifnet *, struct mbuf *,
232 rip_append(struct inpcb *last, struct ip *ip, struct mbuf *n,
251 if (last->inp_ip_minttl && last->inp_ip_minttl > ip->ip_ttl)
260 ip_savecontrol(last, &opts, ip, n);
285 struct ip *ip = mtod(m, struct ip *);
296 ripsrc.sin_addr = ip->ip_src;
301 hash = INP_PCBHASH_RAW(proto, ip->ip_src.s_addr,
302 ip->ip_dst.s_addr, V_ripcbinfo.ipi_hashmask);
312 if (inp->inp_laddr.s_addr != ip->ip_dst.s_addr)
314 if (inp->inp_faddr.s_addr != ip->ip_src.s_addr)
321 (void) rip_append(last, ip, n, &ripsrc);
334 if (prison_check_ip4(inp->inp_cred, &ip->ip_dst) != 0)
351 !in_hosteq(inp->inp_laddr, ip->ip_dst))
354 !in_hosteq(inp->inp_faddr, ip->ip_src))
361 (void) rip_append(last, ip, n, &ripsrc);
375 if (!IN_MULTICAST(ntohl(ip->ip_dst.s_addr)) &&
376 prison_check_ip4(inp->inp_cred, &ip->ip_dst) != 0)
386 IN_MULTICAST(ntohl(ip->ip_dst.s_addr))) {
408 group.sin_addr = ip->ip_dst;
428 if (rip_append(last, ip, m, &ripsrc) != 0)
432 if (inetsw[ip_protox[ip->ip_p]].pr_input == rip_input) {
450 struct ip *ip;
469 if (m->m_pkthdr.len + sizeof(struct ip) > IP_MAXPACKET) {
473 M_PREPEND(m, sizeof(struct ip), M_NOWAIT);
478 ip = mtod(m, struct ip *);
479 ip->ip_tos = inp->inp_ip_tos;
481 ip->ip_off = htons(IP_DF);
483 ip->ip_off = htons(0);
484 ip->ip_p = inp->inp_ip_p;
485 ip->ip_len = htons(m->m_pkthdr.len);
486 ip->ip_src = inp->inp_laddr;
487 ip->ip_dst.s_addr = dst;
494 if (ip->ip_src.s_addr == INADDR_ANY) {
495 error = in_pcbladdr(inp, &ip->ip_dst, &ip->ip_src,
499 &ip->ip_src);
507 ip->ip_ttl = inp->inp_ip_ttl;
513 ip = mtod(m, struct ip *);
514 hlen = ip->ip_hl << 2;
519 ip = mtod(m, struct ip *);
527 if ((hlen < sizeof (*ip))
528 || ((hlen > sizeof (*ip)) && inp->inp_options)
529 || (ntohs(ip->ip_len) != m->m_pkthdr.len)) {
534 error = prison_check_ip4(inp->inp_cred, &ip->ip_src);
545 cp = (u_char *)(ip + 1);
546 cnt = hlen - sizeof (struct ip);
572 if (ip->ip_id == 0)
573 ip_fillid(ip);