|
Lines 1115-1121
ipfw_chk(struct ip_fw_args *args)
Link Here
|
| 1115 |
uint8_t proto; |
1115 |
uint8_t proto; |
| 1116 |
uint16_t src_port = 0, dst_port = 0; /* NOTE: host format */ |
1116 |
uint16_t src_port = 0, dst_port = 0; /* NOTE: host format */ |
| 1117 |
struct in_addr src_ip, dst_ip; /* NOTE: network format */ |
1117 |
struct in_addr src_ip, dst_ip; /* NOTE: network format */ |
| 1118 |
uint16_t iplen=0; |
1118 |
int iplen = 0; |
| 1119 |
int pktlen; |
1119 |
int pktlen; |
| 1120 |
uint16_t etype = 0; /* Host order stored ether type */ |
1120 |
uint16_t etype = 0; /* Host order stored ether type */ |
| 1121 |
|
1121 |
|
|
Lines 1357-1362
do { \
Link Here
|
| 1357 |
args->f_id.src_ip = 0; |
1357 |
args->f_id.src_ip = 0; |
| 1358 |
args->f_id.dst_ip = 0; |
1358 |
args->f_id.dst_ip = 0; |
| 1359 |
args->f_id.flow_id6 = ntohl(ip6->ip6_flow); |
1359 |
args->f_id.flow_id6 = ntohl(ip6->ip6_flow); |
|
|
1360 |
iplen = ntohs(ip6->ip6_plen) + sizeof(*ip6); |
| 1360 |
} else if (pktlen >= sizeof(struct ip) && |
1361 |
} else if (pktlen >= sizeof(struct ip) && |
| 1361 |
(args->eh == NULL || etype == ETHERTYPE_IP) && ip->ip_v == 4) { |
1362 |
(args->eh == NULL || etype == ETHERTYPE_IP) && ip->ip_v == 4) { |
| 1362 |
is_ipv4 = 1; |
1363 |
is_ipv4 = 1; |
|
Lines 1371-1377
do { \
Link Here
|
| 1371 |
dst_ip = ip->ip_dst; |
1372 |
dst_ip = ip->ip_dst; |
| 1372 |
offset = ntohs(ip->ip_off) & IP_OFFMASK; |
1373 |
offset = ntohs(ip->ip_off) & IP_OFFMASK; |
| 1373 |
iplen = ntohs(ip->ip_len); |
1374 |
iplen = ntohs(ip->ip_len); |
| 1374 |
pktlen = iplen < pktlen ? iplen : pktlen; |
|
|
| 1375 |
|
1375 |
|
| 1376 |
if (offset == 0) { |
1376 |
if (offset == 0) { |
| 1377 |
switch (proto) { |
1377 |
switch (proto) { |
|
Lines 1410-1415
do { \
Link Here
|
| 1410 |
args->f_id.dst_ip = ntohl(dst_ip.s_addr); |
1410 |
args->f_id.dst_ip = ntohl(dst_ip.s_addr); |
| 1411 |
} |
1411 |
} |
| 1412 |
#undef PULLUP_TO |
1412 |
#undef PULLUP_TO |
|
|
1413 |
pktlen = iplen < pktlen ? iplen: pktlen; |
| 1413 |
if (proto) { /* we may have port numbers, store them */ |
1414 |
if (proto) { /* we may have port numbers, store them */ |
| 1414 |
args->f_id.proto = proto; |
1415 |
args->f_id.proto = proto; |
| 1415 |
args->f_id.src_port = src_port = ntohs(src_port); |
1416 |
args->f_id.src_port = src_port = ntohs(src_port); |
|
Lines 1930-1939
do { \
Link Here
|
| 1930 |
uint16_t x; |
1931 |
uint16_t x; |
| 1931 |
uint16_t *p; |
1932 |
uint16_t *p; |
| 1932 |
int i; |
1933 |
int i; |
| 1933 |
|
1934 |
#ifdef INET6 |
|
|
1935 |
if (is_ipv6) { |
| 1936 |
struct ip6_hdr *ip6; |
| 1937 |
|
| 1938 |
ip6 = (struct ip6_hdr *)ip; |
| 1939 |
if (ip6->ip6_plen == 0) { |
| 1940 |
/* |
| 1941 |
* Jumbo payload is not |
| 1942 |
* supported by this |
| 1943 |
* opcode. |
| 1944 |
*/ |
| 1945 |
break; |
| 1946 |
} |
| 1947 |
x = iplen - hlen; |
| 1948 |
} else |
| 1949 |
#endif /* INET6 */ |
| 1950 |
x = iplen - (ip->ip_hl << 2); |
| 1934 |
tcp = TCP(ulp); |
1951 |
tcp = TCP(ulp); |
| 1935 |
x = iplen - |
1952 |
x -= tcp->th_off << 2; |
| 1936 |
((ip->ip_hl + tcp->th_off) << 2); |
|
|
| 1937 |
if (cmdlen == 1) { |
1953 |
if (cmdlen == 1) { |
| 1938 |
match = (cmd->arg1 == x); |
1954 |
match = (cmd->arg1 == x); |
| 1939 |
break; |
1955 |
break; |