Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Expiretable Port fails to compile

    Scheduled Pinned Locked Moved 2.5 Development Snapshots (Retired)
    1 Posts 1 Posters 264 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ?
      A Former User
      last edited by A Former User

      Recent changes to pfvar.h split it into kernel/userland pieces, that results in the expiretable port to fail to compile. On inspection, the get_status code in the ioctl__helpers is not used. My solution was to modify the port to remove the declaration and offending code. I can create a issue and pull request if you like, but its a simple addition of two patches that delete the unused code.

      The Patches are below:
      patch-ioctl__helpers.h:

      --- ioctl_helpers.h.orig	2006-01-18 17:31:41 UTC
      +++ ioctl_helpers.h
      @@ -31,6 +31,5 @@ int	radix_get_tstats(int dev, struct pfr_tstats **tsta
       int	radix_get_tables(int dev, struct pfr_table **tables, const struct pfr_table *filter, int flags);
       int	radix_get_addrs(int dev, const struct pfr_table *table, struct pfr_addr **addrs, int flags);
       int	radix_del_addrs(int dev, const struct pfr_table *table, struct pfr_addr *addrs, int addr_count, int flags);
      -int	get_states(int dev, struct pf_state **states);
       
       #endif /*_IOCTL_HELPERS_H_*/
      
      

      patch-ioctl__helpers.c:

      --- ioctl_helpers.c.orig	2006-01-18 17:31:41 UTC
      +++ ioctl_helpers.c
      @@ -160,46 +160,3 @@ radix_get_tstats(int dev, struct pfr_tstats **tstats, 
       	*tstats = (struct pfr_tstats *)pt.pfrio_buffer;
       	return pt.pfrio_size;
       }
      -
      -
      -int
      -get_states(int dev, struct pf_state **states) { 
      -	struct pfioc_states ps;
      -	caddr_t inbuf, newinbuf;
      -	size_t len = 0;
      -
      -	inbuf = newinbuf = NULL;
      -	memset(&ps, 0, sizeof(struct pfioc_states));
      -	*states = NULL;	
      -	for (;;) {
      -		ps.ps_len = len;
      -		if (len) {
      -			newinbuf = realloc(inbuf, len);
      -			if (newinbuf == NULL) {
      -				if (inbuf != NULL) {
      -					free(inbuf);
      -					inbuf = newinbuf = NULL;
      -					return (-1);
      -				}
      -			}
      -			ps.ps_buf = inbuf = newinbuf;
      -		}
      -		if (ioctl(dev, DIOCGETSTATES, &ps) < 0) {
      -			if (inbuf != NULL) {
      -				free(inbuf);
      -				inbuf = newinbuf = NULL;
      -			}
      -			return (-1);
      -		}
      -		if (ps.ps_len + sizeof(struct pfioc_states) < len)
      -			break; /* We have states! */
      -		if (ps.ps_len == 0)
      -			return (0); /* No states available */
      -		if (len == 0)
      -			len = ps.ps_len;
      -		len *= 2;
      -	}
      -		
      -	*states = ps.ps_states;
      -	return ps.ps_len / sizeof(struct pf_state);
      -}
      
      
      1 Reply Last reply Reply Quote 0
      • First post
        Last post
      Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.