diff options
author | luigi <luigi@FreeBSD.org> | 2002-07-17 07:21:42 +0000 |
---|---|---|
committer | luigi <luigi@FreeBSD.org> | 2002-07-17 07:21:42 +0000 |
commit | 7bf1404d8f8a960b823a15fd0b3a235b642e1bc6 (patch) | |
tree | 609c92dfb49672eae0b2a40d8cafac4829792bea /sys | |
parent | f04e00720beb287dca8e1f97c56bf2262eb0d7b9 (diff) | |
download | FreeBSD-src-7bf1404d8f8a960b823a15fd0b3a235b642e1bc6.zip FreeBSD-src-7bf1404d8f8a960b823a15fd0b3a235b642e1bc6.tar.gz |
Fix a panic when doing "ipfw add pipe 1 log ..."
Also synchronize ip_dummynet.c with the version in RELENG_4 to
ease MFC's.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/netinet/ip_dummynet.c | 35 | ||||
-rw-r--r-- | sys/netinet/ip_fw.h | 2 |
2 files changed, 31 insertions, 6 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 ; diff --git a/sys/netinet/ip_fw.h b/sys/netinet/ip_fw.h index 4ea0c50..12073b5 100644 --- a/sys/netinet/ip_fw.h +++ b/sys/netinet/ip_fw.h @@ -27,7 +27,7 @@ #ifndef _IPFW2_H #define _IPFW2_H - +#define IPFW2 1 /* * The kernel representation of ipfw rules is made of a list of * 'instructions' (for all practical purposes equivalent to BPF |