Permalink
Browse files

Added tweaks to ipfw command for Mac OS X

  • Loading branch information...
1 parent f06c775 commit 2a5bc7ed1456e0c63a87e89c8837be555c33211d @damienstuart damienstuart committed Jul 14, 2012
Showing with 18 additions and 7 deletions.
  1. +2 −0 server/fw_util_ipfw.c
  2. +15 −6 server/fw_util_ipfw.h
  3. +1 −1 server/pcap_capture.h
@@ -848,7 +848,9 @@ ipfw_purge_expired_rules(const fko_srv_options_t *opts)
snprintf(cmd_buf, CMD_BUFSIZE-1, "%s " IPFW_DEL_RULE_ARGS,
opts->fw_config->fw_command,
+#ifndef __APPLE__
fwc.expire_set_num,
+#endif
curr_rule
);
View
@@ -45,13 +45,22 @@ enum {
#define IPFW_MOVE_RULE_ARGS "set move rule %u to %u"
#define IPFW_MOVE_SET_ARGS "set move %u to %u"
#define IPFW_DISABLE_SET_ARGS "set disable %u"
-#define IPFW_DEL_RULE_ARGS "set %u delete %u"
-#define IPFW_DEL_RULE_SET_ARGS "delete set %u"
-#define IPFW_LIST_RULES_ARGS "-d -S -T set %u list"
#define IPFW_LIST_ALL_RULES_ARGS "list"
-#define IPFW_LIST_SET_RULES_ARGS "set %u list"
-#define IPFW_LIST_EXP_SET_RULES_ARGS "-S set %u list"
-#define IPFW_LIST_SET_DYN_RULES_ARGS "-d set %u list"
+#define IPFW_DEL_RULE_SET_ARGS "delete set %u"
+
+#ifdef __APPLE__
+ #define IPFW_DEL_RULE_ARGS "delete %u" //--DSS diff args
+ #define IPFW_LIST_RULES_ARGS "-d -S -T list | grep 'set %u'"
+ #define IPFW_LIST_SET_RULES_ARGS "-S list | grep 'set %u'"
+ #define IPFW_LIST_EXP_SET_RULES_ARGS "-S list | grep 'set %u'"
+ #define IPFW_LIST_SET_DYN_RULES_ARGS "-d list | grep 'set %u'"
+#else
+ #define IPFW_DEL_RULE_ARGS "set %u delete %u"
+ #define IPFW_LIST_RULES_ARGS "-d -S -T set %u list"
+ #define IPFW_LIST_SET_RULES_ARGS "set %u list"
+ #define IPFW_LIST_EXP_SET_RULES_ARGS "-S set %u list"
+ #define IPFW_LIST_SET_DYN_RULES_ARGS "-d set %u list"
+#endif
void ipfw_purge_expired_rules(const fko_srv_options_t *opts);
@@ -41,7 +41,7 @@
* mode to on unless it is a FreeBSD system. --DSS XXX: What we really need
* to do is figure out what the difference is and address it correctly.
*/
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__APPLE__)
#define DEF_PCAP_NONBLOCK 0
#else
#define DEF_PCAP_NONBLOCK 1

0 comments on commit 2a5bc7e

Please sign in to comment.