[OpenAFS-devel] RX_MAX_FRAGS (yet again)

chas williams chas@cmf.nrl.navy.mil
Thu, 11 Oct 2001 16:33:57 -0400


In message <200110111848.OAA00599@pepsi-one.mit.edu>,Nickolai Zeldovich writes:
>I suspect returning a non-zero value from a function called by
>hash_enum will cause hash_enum to stop iterating, so it'll end
>up getting the MTU of the first matching interface.  Something
>like this might be slightly better if the host has multiple
>matching interfaces (though unfortunately I don't have an SGI
>to test it on).

i thought about it but then i tried to think of a situation in which
i would have 2 interfaces that would match the same network address.
[i suppose i could have interface aliases]

btw, i dont see how the following would work.  if rxi_MatchIfnet()
doesnt terminate the search you will go through all the interfaces.
so match_value be set to the match_value from the last interface, not
the matching interface?  there is a hash_enum_bestmatch() but again
i couldnt see a reason to bother for the given reason.


>--- src/rx/IRIX/rx_knet.c	2001/08/08 06:29:03	1.6
>+++ src/rx/IRIX/rx_knet.c	2001/10/11 18:45:19
>@@ -324,7 +324,6 @@
> {
>   afs_uint32 ppaddr;
>   int match_value = 0;
>-  struct hashbucket *slop;
> 
>   if (numMyNetAddrs == 0)
>     (void) rxi_GetIFInfo();
>@@ -332,11 +331,11 @@
>   ppaddr = ntohl(addr);
>   *pifad = (struct in_ifaddr*)&hashinfo_inaddr;
> 
>-  slop = hash_enum(&hashinfo_inaddr, rxi_MatchIfnet, HTF_INET,
>+  (void) hash_enum(&hashinfo_inaddr, rxi_MatchIfnet, HTF_INET,
> 		   (caddr_t)&ppaddr, (caddr_t)&match_value, (caddr_t)pifad);
> 
>-  if (slop)
>-      return ((struct in_ifaddr*)slop)->ia_ifp;
>+  if (match_value)
>+      return (*pifad)->ia_ifp;
>   else
>       return NULL;