Lines Matching refs:ip

25 #include "ip.h"
116 * (the ip hdr and arp requests) we offset the packet by 2 bytes.
222 * compute an ip style checksum.
279 unsigned short ptype, struct iphdr *ip __unused, struct udphdr *udp __unused)
299 struct iphdr *ip;
304 ip = (struct iphdr *)buf;
305 destip = ip->dest.s_addr;
364 struct iphdr *ip;
365 ip = (struct iphdr *)buf;
366 ip->verhdrlen = 0x45;
367 ip->verhdrlen += (option_len/4);
368 ip->service = 0;
369 ip->len = htons(len);
370 ip->ident = 0;
371 ip->frags = 0; /* Should we set don't fragment? */
372 ip->ttl = ttl;
373 ip->protocol = protocol;
374 ip->chksum = 0;
375 ip->src.s_addr = arptable[ARP_CLIENT].ipaddr.s_addr;
376 ip->dest.s_addr = destip;
377 ip->chksum = ipchksum(buf, sizeof(struct iphdr) + option_len);
380 static uint16_t udpchksum(struct iphdr *ip, struct udphdr *udp)
386 pseudo.src.s_addr = ip->src.s_addr;
387 pseudo.dest.s_addr = ip->dest.s_addr;
405 struct iphdr *ip;
407 ip = (struct iphdr *)buf;
414 if ((udp->chksum = udpchksum(ip, udp)) == 0)
434 struct iphdr *ip __unused, struct udphdr *udp __unused)
456 struct iphdr *ip, struct udphdr *udp)
525 unsigned short ptype __unused, struct iphdr *ip __unused,
575 struct bootpip_t ip;
584 memset(&ip, 0, sizeof(struct bootpip_t));
585 ip.bp.bp_op = BOOTP_REQUEST;
586 ip.bp.bp_htype = 1;
587 ip.bp.bp_hlen = ETH_ALEN;
592 ip.bp.bp_xid = xid += htonl(starttime);
594 memcpy(ip.bp.bp_hwaddr, arptable[ARP_CLIENT].node, ETH_ALEN);
595 memcpy(ip.bp.bp_vend, rfc1533_cookie_bootp, sizeof(rfc1533_cookie_bootp)); /* request RFC-style options */
603 sizeof(struct bootpip_t), &ip);
611 ip.bp.bp_secs = htons((currticks()-starttime)/TICKS_PER_SEC);
622 unsigned short ptype __unused, struct iphdr *ip __unused,
673 struct dhcpip_t ip;
685 memset(&ip, 0, sizeof(ip));
686 ip.bp.bp_op = BOOTP_REQUEST;
687 ip.bp.bp_htype = 1;
688 ip.bp.bp_hlen = ETH_ALEN;
693 ip.bp.bp_xid = xid += htonl(starttime);
694 memcpy(ip.bp.bp_hwaddr, arptable[ARP_CLIENT].node, ETH_ALEN);
695 memcpy(ip.bp.bp_vend, rfc1533_cookie_dhcp, sizeof rfc1533_cookie_dhcp); /* request RFC-style options */
696 memcpy(ip.bp.bp_vend + sizeof rfc1533_cookie_dhcp, dhcpdiscover, sizeof dhcpdiscover);
704 sizeof(ip), &ip);
716 memcpy(ip.bp.bp_vend, rfc1533_cookie_dhcp, sizeof rfc1533_cookie_dhcp);
717 memcpy(ip.bp.bp_vend + sizeof rfc1533_cookie_dhcp, dhcprequest, sizeof dhcprequest);
720 memcpy(&ip.bp.bp_vend[9], &dhcp_server, sizeof(in_addr));
721 memcpy(&ip.bp.bp_vend[15], &dhcp_addr, sizeof(in_addr));
724 sizeof(ip), &ip);
738 ip.bp.bp_secs = htons((currticks()-starttime)/TICKS_PER_SEC);
775 static void process_igmp(struct iphdr *ip, unsigned long now)
780 if (!ip || (ip->protocol == IP_IGMP) ||
784 iplen = (ip->verhdrlen & 0xf)*4;
786 if (ipchksum(igmp, ntohs(ip->len) - iplen) != 0)
789 (ip->dest.s_addr == htonl(GROUP_ALL_HOSTS))) {
812 (ip->dest.s_addr == igmp->group.s_addr)) {
864 /* Only join a group if we are given a multicast ip, this way
865 * code can be given a non-multicast (broadcast or unicast ip)
875 #define process_igmp(ip, now)
884 struct iphdr *ip;
924 ip = 0;
927 ip = (struct iphdr *)&nic.packet[ETH_HLEN];
928 if ((ip->verhdrlen < 0x45) || (ip->verhdrlen > 0x4F))
930 iplen = (ip->verhdrlen & 0xf) * 4;
931 if (ipchksum(ip, iplen) != 0)
933 if (ip->frags & htons(0x3FFF)) {
941 if (ntohs(ip->len) > ETH_MAX_MTU)
946 /* Delete the ip options, to guarantee
956 if (ip && (ip->protocol == IP_UDP) &&
961 if (ntohs(udp->len) > (ntohs(ip->len) - iplen))
964 if (udp->chksum && udpchksum(ip, udp)) {
969 result = reply(ival, ptr, ptype, ip, udp);
1000 process_igmp(ip, now);
1163 ifconfig (char *ip, char *sm, char *gw, char *svr)
1175 if (ip)
1177 if (! inet_aton (ip, &arptable[ARP_CLIENT].ipaddr))
1196 if (ip || sm)