Diff for /fwsync/driver/fwsync_workers.c between versions 1.6 and 1.7

version 1.6, 2022/07/15 09:19:25 version 1.7, 2022/08/03 17:07:07
Line 6 Line 6
   
   
 static int  static int
fwsync_add_state_4(const struct fws_proto *pkt)fwsync_add_state_4(struct ipfw_flow_id *fid, u_int ruleid, u_short rulenum)
 {  {
           struct ip_fw *rule = NULL;
           struct ip_fw_args args;
           struct ipfw_dyn_info info;
           ipfw_insn cmd;
   
         DTRACE();          DTRACE();
   
        return 0;        memset(&cmd, 0, sizeof cmd);
         cmd.opcode = O_KEEP_STATE;
         memset(&info, 0, sizeof info);
         memset(&args, 0, sizeof args);
         memcpy(&args.f_id, fid, sizeof args.f_id);
 
         rule = ipfw_dyn_lookup_state(&args, NULL, 0, &cmd, &info);
         return ipfw_dyn_install_sync_state(fid, rule, ruleid, rulenum);
 }  }
   
 static int  static int
fwsync_add_state_6(const struct fws_proto *pkt)fwsync_add_state_6(struct ipfw_flow_id *fid, u_int ruleid, u_short rulenum)
 {  {
         DTRACE();          DTRACE();
   
Line 24  fwsync_add_state_6(const struct fws_proto *pkt) Line 36  fwsync_add_state_6(const struct fws_proto *pkt)
 int  int
 fwsync_add_state(const struct fws_proto *pkt)  fwsync_add_state(const struct fws_proto *pkt)
 {  {
           struct ipfw_flow_id fid;
   
         DTRACE();          DTRACE();
   
           memset(&fid, 0, sizeof fid);
           fid.fib = pkt->fws_fib;
           fid.proto = pkt->fws_proto;
           fid.addr_type = pkt->fws_addrtype;
           fid.src_port = pkt->fws_sport;
           fid.dst_port = pkt->fws_dport;
           switch (pkt->fws_addrtype) {
                   case 4:
                           fid.src_ip = pkt->fws_saddr.s_addr;
                           fid.dst_ip = pkt->fws_daddr.s_addr;
                           break;
                   case 6:
                           memcpy(&fid.src_ip6, &pkt->fws_saddr6, sizeof fid.src_ip6);
                           memcpy(&fid.dst_ip6, &pkt->fws_daddr6, sizeof fid.dst_ip6);
                           fid.flow_id6 = pkt->fws_scopeid;
                           break;
                   default:
                           return EINVAL;
           }
   
         if (pkt->fws_addrtype == 4)          if (pkt->fws_addrtype == 4)
                fwsync_add_state_4(pkt);                fwsync_add_state_4(&fid, pkt->fws_ruleid, pkt->fws_rulenum);
         else if (pkt->fws_addrtype == 6)          else if (pkt->fws_addrtype == 6)
                fwsync_add_state_6(pkt);                fwsync_add_state_6(&fid, pkt->fws_ruleid, pkt->fws_rulenum);
         else          else
                 return EINVAL;                  return EINVAL;
   
Line 115  out: Line 149  out:
 }  }
   
 int  int
fwsync_state_handler(const void *arg)fwsync_state_handler(const void *arg, const void *extdata)
 {  {
         const struct ipfw_flow_id *pkt = arg;          const struct ipfw_flow_id *pkt = arg;
           const struct ipfw_dyn_hook_extdata *edata = extdata;
         struct fws_proto *spkt;          struct fws_proto *spkt;
         struct fws_sndpkt *p;          struct fws_sndpkt *p;
   
Line 137  fwsync_state_handler(const void *arg) Line 172  fwsync_state_handler(const void *arg)
   
         spkt->fws_version = FWS_PKTVER_STATE;          spkt->fws_version = FWS_PKTVER_STATE;
         spkt->fws_fib = pkt->fib;          spkt->fws_fib = pkt->fib;
           spkt->fws_ruleid = edata->ruleid;
           spkt->fws_rulenum = edata->rulenum;
         spkt->fws_proto = pkt->proto;          spkt->fws_proto = pkt->proto;
         spkt->fws_addrtype = pkt->addr_type;          spkt->fws_addrtype = pkt->addr_type;
         spkt->fws_sport = pkt->src_port;          spkt->fws_sport = pkt->src_port;
Line 168  fwsync_state_handler(const void *arg) Line 205  fwsync_state_handler(const void *arg)
 }  }
   
 int  int
fwsync_alias_handler(const void *arg)fwsync_alias_handler(const void *arg, const void *extdata)
 {  {
         const struct alias_link *lnk = arg;          const struct alias_link *lnk = arg;
         struct fws_proto *spkt;          struct fws_proto *spkt;

Removed from v.1.6  
changed lines
  Added in v.1.7


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>