diff options
Diffstat (limited to 'sys/netinet/ip_dummynet.c')
-rw-r--r-- | sys/netinet/ip_dummynet.c | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/sys/netinet/ip_dummynet.c b/sys/netinet/ip_dummynet.c index 9ec7e0a..4a407d1 100644 --- a/sys/netinet/ip_dummynet.c +++ b/sys/netinet/ip_dummynet.c @@ -1016,13 +1016,23 @@ static __inline struct dn_flow_set * locate_flowset(int pipe_nr, struct ip_fw *rule) { - ipfw_insn_pipe *cmd = (ipfw_insn_pipe *)(rule->cmd + rule->act_ofs); - struct dn_flow_set *fs = (struct dn_flow_set *)(cmd->pipe_ptr); +#if IPFW2 + struct dn_flow_set *fs; + ipfw_insn *cmd = rule->cmd + rule->act_ofs; + + if (cmd->opcode == O_LOG) + cmd += F_LEN(cmd); + fs = ((ipfw_insn_pipe *)cmd)->pipe_ptr; if (fs != NULL) return fs; - if ( cmd->o.opcode == O_QUEUE ) + if (cmd->opcode == O_QUEUE) +#else /* !IPFW2 */ + struct dn_flow_set *fs = NULL ; + + if ( (rule->fw_flg & IP_FW_F_COMMAND) == IP_FW_F_QUEUE ) +#endif /* !IPFW2 */ for (fs=all_flow_sets; fs && fs->fs_nr != pipe_nr; fs=fs->next) ; else { @@ -1032,7 +1042,13 @@ locate_flowset(int pipe_nr, struct ip_fw *rule) if (p1 != NULL) fs = &(p1->fs) ; } - (struct dn_flow_set *)(cmd->pipe_ptr) = fs; /* record for the future */ + /* record for the future */ +#if IPFW2 + ((ipfw_insn_pipe *)cmd)->pipe_ptr = fs; +#else + if (fs != NULL) + rule->pipe_ptr = fs; +#endif return fs ; } @@ -1061,7 +1077,16 @@ dummynet_io(struct mbuf *m, int pipe_nr, int dir, struct ip_fw_args *fwa) u_int64_t len = m->m_pkthdr.len ; struct dn_flow_queue *q = NULL ; int s = splimp(); - int is_pipe = (fwa->rule->cmd[fwa->rule->act_ofs].opcode == O_PIPE); + int is_pipe; +#if IPFW2 + ipfw_insn *cmd = fwa->rule->cmd + fwa->rule->act_ofs; + + if (cmd->opcode == O_LOG) + cmd += F_LEN(cmd); + is_pipe = (cmd->opcode == O_PIPE); +#else + is_pipe = (fwa->rule->fw_flg & IP_FW_F_COMMAND) == IP_FW_F_PIPE; +#endif pipe_nr &= 0xffff ; |