PERFORCE change 111679 for review

Paolo Pisati piso at FreeBSD.org
Thu Dec 14 00:21:37 PST 2006


http://perforce.freebsd.org/chv.cgi?CH=111679

Change 111679 by piso at piso_newluxor on 2006/12/14 08:21:29

	LibAliasOutTry() is a public function, so wrap it around
	LibAliasTryLocked().

Affected files ...

.. //depot/projects/soc2005/libalias/sys/netinet/libalias/alias.c#28 edit

Differences ...

==== //depot/projects/soc2005/libalias/sys/netinet/libalias/alias.c#28 (text+ko) ====

@@ -1214,7 +1214,7 @@
 /* Local prototypes */
 static int
 LibAliasOutLocked(struct libalias *la, char *ptr,
-		  int maxpacketsize);
+		  int maxpacketsize, int create);
 static int
 LibAliasInLocked(struct libalias *la, char *ptr,
 		  int maxpacketsize);
@@ -1239,7 +1239,7 @@
 	
 	if (la->packetAliasMode & PKT_ALIAS_REVERSE) {
 		la->packetAliasMode &= ~PKT_ALIAS_REVERSE;
-		iresult = LibAliasOutLocked(la, ptr, maxpacketsize);
+		iresult = LibAliasOutLocked(la, ptr, maxpacketsize, 1);
 		la->packetAliasMode |= PKT_ALIAS_REVERSE;
 		goto getout;
 	}
@@ -1333,23 +1333,33 @@
 	int res;
 
 	LIBALIAS_LOCK(la);
-	res = LibAliasOutLocked(la, ptr, maxpacketsize);
+	res = LibAliasOutLocked(la, ptr, maxpacketsize, 1);
+	LIBALIAS_UNLOCK(la);
+	return (res);
+}
+
+int
+LibAliasOutTry(struct libalias *la, char *ptr, int maxpacketsize, int create)
+{
+	int res;
+
+	LIBALIAS_LOCK(la);
+	res = LibAliasOutLocked(la, ptr, maxpacketsize, create);
 	LIBALIAS_UNLOCK(la);
 	return (res);
 }
 
 static int
 LibAliasOutLocked(struct libalias *la, char *ptr,	/* valid IP packet */
-    int maxpacketsize		/* How much the packet data may grow (FTP
+    int maxpacketsize,		/* How much the packet data may grow (FTP
 				 * and IRC inline changes) */
+    int create                  /* Create new entries ? */	  
 )
 {
 	int iresult;
-	int create;			/* Create new entries ? */
 	struct in_addr addr_save;
 	struct ip *pip;
 
-	create = 1;
 	if (la->packetAliasMode & PKT_ALIAS_REVERSE) {
 		la->packetAliasMode &= ~PKT_ALIAS_REVERSE;
 		iresult = LibAliasInLocked(la, ptr, maxpacketsize);


More information about the p4-projects mailing list