Lines Matching refs:ip

26 #include <netinet/ip.h>
111 static char* FormatPacket (struct ip*);
112 static void PrintPacket (struct ip*);
113 static void SyslogPacket (struct ip*, int priority, const char *label);
520 struct ip* ip;
552 ip = (struct ip*) buf;
560 switch (ip->ip_p) {
574 printf ("[%d] ", ip->ip_p);
580 PrintPacket (ip);
591 bytes = ntohs (ip->ip_len);
605 PrintPacket (ip);
625 (struct ip*) buf,
646 struct ip* ip;
683 ip = (struct ip*) buf;
699 switch (ip->ip_p) {
713 printf ("[%d] ", ip->ip_p);
719 PrintPacket (ip);
741 SyslogPacket (ip, LOG_WARNING, "denied");
749 bytes = ntohs (ip->ip_len);
764 PrintPacket (ip);
785 (struct ip*) buf,
831 static void PrintPacket (struct ip* ip)
833 printf ("%s", FormatPacket (ip));
836 static void SyslogPacket (struct ip* ip, int priority, const char *label)
838 syslog (priority, "%s %s", label, FormatPacket (ip));
841 static char* FormatPacket (struct ip* ip)
850 strcpy (src, inet_ntoa (ip->ip_src));
851 strcpy (dst, inet_ntoa (ip->ip_dst));
853 switch (ip->ip_p) {
855 tcphdr = (struct tcphdr*) ((char*) ip + (ip->ip_hl << 2));
864 udphdr = (struct udphdr*) ((char*) ip + (ip->ip_hl << 2));
873 icmphdr = (struct icmp*) ((char*) ip + (ip->ip_hl << 2));
882 sprintf (buf, "[%d] %s -> %s ", ip->ip_p, src, dst);
1999 struct instance *ip;
2001 LIST_FOREACH(ip, &root, list) {
2002 if (!strcmp(ip->name, name)) {
2003 mla = ip->la;
2004 mip = ip;
2009 ip = calloc(1, sizeof(*ip));
2010 ip->name = strdup(name);
2011 ip->la = LibAliasInit (ip->la);
2012 ip->assignAliasAddr = 0;
2013 ip->ifName = NULL;
2014 ip->logDropped = 0;
2015 ip->inPort = 0;
2016 ip->outPort = 0;
2017 ip->inOutPort = 0;
2018 ip->aliasAddr.s_addr = INADDR_NONE;
2019 ip->ifMTU = -1;
2020 ip->aliasOverhead = 12;
2021 LIST_INSERT_HEAD(&root, ip, list);
2022 mla = ip->la;
2023 mip = ip;
2032 if (sysctlbyname("net.inet.ip.fw.default_rule", &default_rule, &len,