Lines Matching refs:ip

68 #include <netinet/ip.h>
82 extern int _ip_mforward(struct ip *ip, struct ifnet *ifp,
124 _ip_mforward(__unused struct ip *ip, __unused struct ifnet *ifp,
130 int (*ip_mforward)(struct ip *, struct ifnet *, struct mbuf *,
262 static struct ip multicast_encap_iphdr = {
264 sizeof(struct ip) >> 2, IPVERSION,
266 IPVERSION, sizeof(struct ip) >> 2,
269 sizeof(struct ip), /* total length */
285 * given a datagram's src ip address.
291 static int X_ip_mforward(struct ip *ip, struct ifnet *ifp, struct mbuf *m, struct ip_moptions *imo);
310 static void phyint_send(struct ip *, struct vif *, struct mbuf *);
311 static void encap_send(struct ip *, struct vif *, struct mbuf *);
312 static void tbf_control(struct vif *, struct mbuf *, struct ip *, u_int32_t);
316 static int tbf_dq_sel(struct vif *, struct ip *);
319 static int priority(struct vif *, struct ip *);
1053 * pointed to by "ip" has arrived on (or is about to be sent to) the interface
1066 X_ip_mforward(struct ip *ip, struct ifnet *ifp, struct mbuf *m,
1080 (u_int32_t)ntohl(ip->ip_src.s_addr), (u_int32_t)ntohl(ip->ip_dst.s_addr),
1083 if (ip->ip_hl < (IP_HDR_LEN + TUNNEL_LEN) >> 2 ||
1084 (ipoptions = (u_char *)(ip + 1))[1] != IPOPT_LSRR ) {
1097 (u_int32_t)ntohl(ip->ip_src.s_addr));
1106 if (ip->ip_ttl < 255)
1107 ip->ip_ttl++; /* compensate for -1 in *_send routines */
1108 if (rsvpdebug && ip->ip_p == IPPROTO_RSVP) {
1111 ntohl(ip->ip_src.s_addr), ntohl(ip->ip_dst.s_addr), vifi,
1119 if (rsvpdebug && ip->ip_p == IPPROTO_RSVP) {
1121 ntohl(ip->ip_src.s_addr), ntohl(ip->ip_dst.s_addr));
1130 if (ip->ip_ttl <= 1 ||
1131 ntohl(ip->ip_dst.s_addr) <= INADDR_MAX_LOCAL_GROUP)
1137 MFCFIND(ip->ip_src.s_addr, ip->ip_dst.s_addr, rt);
1152 int hlen = ip->ip_hl << 2;
1162 (u_int32_t)ntohl(ip->ip_src.s_addr),
1163 (u_int32_t)ntohl(ip->ip_dst.s_addr));
1183 hash = MFCHASH(ip->ip_src.s_addr, ip->ip_dst.s_addr);
1185 if ((ip->ip_src.s_addr == rt->mfc_origin.s_addr) &&
1186 (ip->ip_dst.s_addr == rt->mfc_mcastgrp.s_addr) &&
1215 k_igmpsrc.sin_addr = ip->ip_src;
1233 rt->mfc_origin.s_addr = ip->ip_src.s_addr;
1234 rt->mfc_mcastgrp.s_addr = ip->ip_dst.s_addr;
1277 int (*ip_mforward)(struct ip *, struct ifnet *, struct mbuf *,
1339 struct ip *ip = mtod(m, struct ip *);
1342 int plen = ip->ip_len;
1349 #define MC_SEND(ip,vifp,m) { \
1351 encap_send((ip), (vifp), (m)); \
1353 phyint_send((ip), (vifp), (m)); \
1362 MC_SEND(ip, viftable + xmt_vif, m);
1388 int hlen = ip->ip_hl << 2;
1420 if (ip->ip_src.s_addr == viftable[vifi].v_lcl_addr.s_addr) {
1438 (ip->ip_ttl > rt->mfc_ttls[vifi])) {
1441 MC_SEND(ip, vifp, m);
1481 phyint_send(struct ip *ip, struct vif *vifp, struct mbuf *m)
1484 int hlen = ip->ip_hl << 2;
1500 tbf_control(vifp, mb_copy, mtod(mb_copy, struct ip *), ip->ip_len);
1504 encap_send(struct ip *ip, struct vif *vifp, struct mbuf *m)
1507 struct ip *ip_copy;
1508 int i, len = ip->ip_len;
1539 ip_copy = mtod(mb_copy, struct ip *);
1553 ip = (struct ip *)((caddr_t)ip_copy + sizeof(multicast_encap_iphdr));
1554 --ip->ip_ttl;
1557 HTONS(ip->ip_len);
1558 HTONS(ip->ip_off);
1561 ip->ip_sum = 0;
1563 ip->ip_sum = in_cksum(mb_copy, ip->ip_hl << 2);
1569 tbf_control(vifp, mb_copy, ip, ip_copy->ip_len);
1573 * De-encapsulate a packet and feed it back through ip input (this
1585 struct ip *ip = mtod(m, struct ip *);
1586 int hlen = ip->ip_hl << 2;
1600 if (! IN_MULTICAST(ntohl(((struct ip *)((char *)ip + hlen))->ip_dst.s_addr))) {
1605 if (ip->ip_src.s_addr != last_encap_src) {
1610 last_encap_src = ip->ip_src.s_addr;
1613 if (vifp->v_rmt_addr.s_addr == ip->ip_src.s_addr) {
1626 (u_int32_t)ntohl(ip->ip_src.s_addr));
1646 tbf_control(struct vif *vifp, struct mbuf *m, struct ip *ip,
1681 if (!tbf_dq_sel(vifp, ip)) {
1739 len = mtod(m, struct ip *)->ip_len;
1781 tbf_dq_sel(struct vif *vifp, struct ip *ip)
1788 p = priority(vifp, ip);
1793 if (p > priority(vifp, mtod(m, struct ip *))) {
1832 imo->imo_multicast_ttl = mtod(m, struct ip *)->ip_ttl - 1;
1885 priority(__unused struct vif *vifp, struct ip *ip)
1898 if (ip->ip_p == IPPROTO_UDP) {
1899 struct udphdr *udp = (struct udphdr *)(((char *)ip) + (ip->ip_hl << 2));
2039 struct ip *ip = mtod(m, struct ip *);
2089 rsvp_src.sin_addr = ip->ip_src;