*** ip_nat.c	Mon May 17 13:25:48 2004
--- ip_nat.c	Mon May 17 13:35:27 2004
***************
*** 1155,1162 ****
--- 1155,1163 ----
  {
  	ap_session_t *aps;
  	nat_save_t ipn;
  	nat_t *n, *nat;
+ 	caddr_t ca;
  	int error;
  
  	error = fr_inobj(data, &ipn, IPFOBJ_NATSAVE);
  	if (error != 0)
***************
*** 1182,1206 ****
  		if (n == NULL)
  			return ESRCH;
  	}
  
  	/*
  	 * Copy out the NAT structure.
  	 */
! 	error = copyoutptr((char *)nat,
! 			   (char *)data + offsetof(struct nat_save, ipn_nat),
! 			   sizeof(struct nat));
  	if (error != 0)
  		return error;
  
  	/*
  	 * If we have a pointer to the NAT rule it belongs to, save that too.
  	 */
  	if (nat->nat_ptr != NULL) {
! 		error = copyoutptr((char *)nat->nat_ptr,
! 				   (char *)data +
! 				   offsetof(struct nat_save, ipn_ipnat),
! 				   sizeof(struct ipnat));
  		if (error != 0)
  			return error;
  	}
  
--- 1183,1209 ----
  		if (n == NULL)
  			return ESRCH;
  	}
  
+ 	/* 
+ 	 * Jump obj struct 
+ 	 */
+ 	data = ((ipfobj_t*)data)->ipfo_ptr;
+ 
  	/*
  	 * Copy out the NAT structure.
  	 */
! 	ca = data + offsetof(struct nat_save, ipn_nat);
! 	error = copyoutptr((char *)nat,&ca,sizeof(struct nat));
  	if (error != 0)
  		return error;
  
  	/*
  	 * If we have a pointer to the NAT rule it belongs to, save that too.
  	 */
  	if (nat->nat_ptr != NULL) {
! 		ca = (char *)data + offsetof(struct nat_save, ipn_ipnat);
! 		error = copyoutptr((char *)nat->nat_ptr,&ca,sizeof(struct ipnat));
  		if (error != 0)
  			return error;
  	}
  
***************
*** 1208,1219 ****
  	 * If we also know the NAT entry has an associated filter rule,
  	 * save that too.
  	 */
  	if (nat->nat_fr != NULL) {
! 		error = copyoutptr((char *)nat->nat_fr,
! 				   (char *)data +
! 				   offsetof(struct nat_save, ipn_rule),
! 				   sizeof(struct frentry));
  		if (error != 0)
  			return error;
  	}
  
--- 1211,1220 ----
  	 * If we also know the NAT entry has an associated filter rule,
  	 * save that too.
  	 */
  	if (nat->nat_fr != NULL) {
! 		ca = data + offsetof(struct nat_save, ipn_rule);
! 		error = copyoutptr((char *)nat->nat_fr,&ca,sizeof(struct frentry));
  		if (error != 0)
  			return error;
  	}
  
***************
*** 1226,1251 ****
  	if (aps != NULL) {
  		ipn.ipn_dsize = sizeof(*aps);
  		if (aps->aps_data)
  			ipn.ipn_dsize += aps->aps_psiz;
! 		error = copyoutptr((char *)&ipn.ipn_dsize,
! 				   (char *)data +
! 				   offsetof(struct nat_save, ipn_dsize),
! 				   sizeof(ipn.ipn_dsize));
  		if (error != 0)
  			return error;
  
! 		error = copyoutptr((char *)aps, (char *)data +
! 				   offsetof(struct nat_save, ipn_data),
! 				   sizeof(*aps));
  		if (error != 0)
  			return error;
  
  		if (aps->aps_psiz > 0) {
! 			error = copyoutptr((char *)aps->aps_data,
! 					   (char *)data + sizeof(*aps) +
! 					   offsetof(struct nat_save, ipn_data),
! 					   aps->aps_psiz);
  			if (error != 0)
  				return error;
  		}
  	}
--- 1227,1247 ----
  	if (aps != NULL) {
  		ipn.ipn_dsize = sizeof(*aps);
  		if (aps->aps_data)
  			ipn.ipn_dsize += aps->aps_psiz;
! 		ca = data + offsetof(struct nat_save, ipn_dsize);
! 		error = copyoutptr((char *)&ipn.ipn_dsize,&ca,sizeof(ipn.ipn_dsize));
  		if (error != 0)
  			return error;
  
! 		ca = data + offsetof(struct nat_save, ipn_data);
! 		error = copyoutptr((char *)aps,&ca,sizeof(*aps));
  		if (error != 0)
  			return error;
  
  		if (aps->aps_psiz > 0) {
! 			ca = data + + sizeof(*aps) + offsetof(struct nat_save, ipn_data);
! 			error = copyoutptr((char *)aps->aps_data,&ca,aps->aps_psiz);
  			if (error != 0)
  				return error;
  		}
  	}
***************
*** 1275,1282 ****
--- 1271,1283 ----
  
  	error = fr_inobj(data, &ipn, IPFOBJ_NATSAVE);
  	if (error != 0)
  		return error;
+ 
+ 	/* 
+ 	 * Jump obj struct 
+ 	 */
+ 	data = ((ipfobj_t*)data)->ipfo_ptr;
  
  	nat = NULL;
  	if (ipn.ipn_dsize != 0) {
  		KMALLOCS(ipnn, nat_save_t *, sizeof(ipn) + ipn.ipn_dsize -
