Re: svn commit: r208553 - in head/sys: net netinet

2010-05-25 Thread Robert Watson


On Tue, 25 May 2010, Qing Li wrote:


Author: qingli
Date: Tue May 25 20:42:35 2010
New Revision: 208553
URL: http://svn.freebsd.org/changeset/base/208553

Log:
 This patch fixes the problem where proxy ARP entries cannot be added
 over the if_ng interface.


Hi Qing--

It may be worth checking network-related kernel modules in the ports tree to 
make sure none reference this symbol (i.e., the virtualbox network device 
parts).  If they do, you may need to add a new symbol in the MFC so that 
existing modules continue to function, and existing kernel module code 
continues to compile.  If not, shouldn't be an issue (none of the base system 
modules seem to use it, but we may care about external modules that do in 
-STABLE).


Robert



 MFC after: 3 days

Modified:
 head/sys/net/if.c
 head/sys/net/if_var.h
 head/sys/net/route.c
 head/sys/net/rtsock.c
 head/sys/netinet/in.c
 head/sys/netinet/in_pcb.c
 head/sys/netinet/ip_options.c
 head/sys/netinet/ip_output.c

Modified: head/sys/net/if.c
==
--- head/sys/net/if.c   Tue May 25 20:35:39 2010(r208552)
+++ head/sys/net/if.c   Tue May 25 20:42:35 2010(r208553)
@@ -1607,7 +1607,7 @@ done:
 * is most specific found.
 */
struct ifaddr *
-ifa_ifwithnet(struct sockaddr *addr)
+ifa_ifwithnet(struct sockaddr *addr, int ignore_ptp)
{
struct ifnet *ifp;
struct ifaddr *ifa;
@@ -1639,7 +1639,8 @@ ifa_ifwithnet(struct sockaddr *addr)

if (ifa->ifa_addr->sa_family != af)
next:   continue;
-   if (af == AF_INET && ifp->if_flags & IFF_POINTOPOINT) {
+   if (af == AF_INET &&
+   ifp->if_flags & IFF_POINTOPOINT && !ignore_ptp) {
/*
 * This is a bit broken as it doesn't
 * take into account that the remote end may

Modified: head/sys/net/if_var.h
==
--- head/sys/net/if_var.h   Tue May 25 20:35:39 2010(r208552)
+++ head/sys/net/if_var.h   Tue May 25 20:42:35 2010(r208553)
@@ -873,7 +873,7 @@ struct  ifaddr *ifa_ifwithaddr(struct soc
int ifa_ifwithaddr_check(struct sockaddr *);
struct  ifaddr *ifa_ifwithbroadaddr(struct sockaddr *);
struct  ifaddr *ifa_ifwithdstaddr(struct sockaddr *);
-struct ifaddr *ifa_ifwithnet(struct sockaddr *);
+struct ifaddr *ifa_ifwithnet(struct sockaddr *, int);
struct  ifaddr *ifa_ifwithroute(int, struct sockaddr *, struct sockaddr *);
struct  ifaddr *ifa_ifwithroute_fib(int, struct sockaddr *, struct sockaddr *, 
u_int);


Modified: head/sys/net/route.c
==
--- head/sys/net/route.cTue May 25 20:35:39 2010(r208552)
+++ head/sys/net/route.cTue May 25 20:42:35 2010(r208553)
@@ -519,7 +519,7 @@ rtredirect_fib(struct sockaddr *dst,
}

/* verify the gateway is directly reachable */
-   if ((ifa = ifa_ifwithnet(gateway)) == NULL) {
+   if ((ifa = ifa_ifwithnet(gateway, 0)) == NULL) {
error = ENETUNREACH;
goto out;
}
@@ -686,7 +686,7 @@ ifa_ifwithroute_fib(int flags, struct so
ifa = ifa_ifwithdstaddr(gateway);
}
if (ifa == NULL)
-   ifa = ifa_ifwithnet(gateway);
+   ifa = ifa_ifwithnet(gateway, 0);
if (ifa == NULL) {
struct rtentry *rt = rtalloc1_fib(gateway, 0, RTF_RNH_LOCKED, 
fibnum);
if (rt == NULL)
@@ -797,7 +797,7 @@ rt_getifa_fib(struct rt_addrinfo *info,
 */
if (info->rti_ifp == NULL && ifpaddr != NULL &&
ifpaddr->sa_family == AF_LINK &&
-   (ifa = ifa_ifwithnet(ifpaddr)) != NULL) {
+   (ifa = ifa_ifwithnet(ifpaddr, 0)) != NULL) {
info->rti_ifp = ifa->ifa_ifp;
ifa_free(ifa);
}

Modified: head/sys/net/rtsock.c
==
--- head/sys/net/rtsock.c   Tue May 25 20:35:39 2010(r208552)
+++ head/sys/net/rtsock.c   Tue May 25 20:42:35 2010(r208553)
@@ -55,6 +55,7 @@
#include 
#include 
#include 
+#include 
#include 
#include 
#include 
@@ -673,12 +674,22 @@ route_output(struct mbuf *m, struct sock
 * another search to retrieve the prefix route of
 * the local end point of the PPP link.
 */
-   if ((rtm->rtm_flags & RTF_ANNOUNCE) &&
-   (rt->rt_ifp->if_flags & IFF_POINTOPOINT)) {
+   if (rtm->rtm_flags & RTF_ANNOUNCE) {
struct sockaddr laddr;
-   rt_maskedcopy(rt->rt_ifa->ifa_addr,
- &laddr,
- rt-

svn commit: r208553 - in head/sys: net netinet

2010-05-25 Thread Qing Li
Author: qingli
Date: Tue May 25 20:42:35 2010
New Revision: 208553
URL: http://svn.freebsd.org/changeset/base/208553

Log:
  This patch fixes the problem where proxy ARP entries cannot be added
  over the if_ng interface.
  
  MFC after:3 days

Modified:
  head/sys/net/if.c
  head/sys/net/if_var.h
  head/sys/net/route.c
  head/sys/net/rtsock.c
  head/sys/netinet/in.c
  head/sys/netinet/in_pcb.c
  head/sys/netinet/ip_options.c
  head/sys/netinet/ip_output.c

Modified: head/sys/net/if.c
==
--- head/sys/net/if.c   Tue May 25 20:35:39 2010(r208552)
+++ head/sys/net/if.c   Tue May 25 20:42:35 2010(r208553)
@@ -1607,7 +1607,7 @@ done:
  * is most specific found.
  */
 struct ifaddr *
-ifa_ifwithnet(struct sockaddr *addr)
+ifa_ifwithnet(struct sockaddr *addr, int ignore_ptp)
 {
struct ifnet *ifp;
struct ifaddr *ifa;
@@ -1639,7 +1639,8 @@ ifa_ifwithnet(struct sockaddr *addr)
 
if (ifa->ifa_addr->sa_family != af)
 next:  continue;
-   if (af == AF_INET && ifp->if_flags & IFF_POINTOPOINT) {
+   if (af == AF_INET && 
+   ifp->if_flags & IFF_POINTOPOINT && !ignore_ptp) {
/*
 * This is a bit broken as it doesn't
 * take into account that the remote end may

Modified: head/sys/net/if_var.h
==
--- head/sys/net/if_var.h   Tue May 25 20:35:39 2010(r208552)
+++ head/sys/net/if_var.h   Tue May 25 20:42:35 2010(r208553)
@@ -873,7 +873,7 @@ struct  ifaddr *ifa_ifwithaddr(struct soc
 intifa_ifwithaddr_check(struct sockaddr *);
 struct ifaddr *ifa_ifwithbroadaddr(struct sockaddr *);
 struct ifaddr *ifa_ifwithdstaddr(struct sockaddr *);
-struct ifaddr *ifa_ifwithnet(struct sockaddr *);
+struct ifaddr *ifa_ifwithnet(struct sockaddr *, int);
 struct ifaddr *ifa_ifwithroute(int, struct sockaddr *, struct sockaddr *);
 struct ifaddr *ifa_ifwithroute_fib(int, struct sockaddr *, struct sockaddr *, 
u_int);
 

Modified: head/sys/net/route.c
==
--- head/sys/net/route.cTue May 25 20:35:39 2010(r208552)
+++ head/sys/net/route.cTue May 25 20:42:35 2010(r208553)
@@ -519,7 +519,7 @@ rtredirect_fib(struct sockaddr *dst,
}
 
/* verify the gateway is directly reachable */
-   if ((ifa = ifa_ifwithnet(gateway)) == NULL) {
+   if ((ifa = ifa_ifwithnet(gateway, 0)) == NULL) {
error = ENETUNREACH;
goto out;
}
@@ -686,7 +686,7 @@ ifa_ifwithroute_fib(int flags, struct so
ifa = ifa_ifwithdstaddr(gateway);
}
if (ifa == NULL)
-   ifa = ifa_ifwithnet(gateway);
+   ifa = ifa_ifwithnet(gateway, 0);
if (ifa == NULL) {
struct rtentry *rt = rtalloc1_fib(gateway, 0, RTF_RNH_LOCKED, 
fibnum);
if (rt == NULL)
@@ -797,7 +797,7 @@ rt_getifa_fib(struct rt_addrinfo *info, 
 */
if (info->rti_ifp == NULL && ifpaddr != NULL &&
ifpaddr->sa_family == AF_LINK &&
-   (ifa = ifa_ifwithnet(ifpaddr)) != NULL) {
+   (ifa = ifa_ifwithnet(ifpaddr, 0)) != NULL) {
info->rti_ifp = ifa->ifa_ifp;
ifa_free(ifa);
}

Modified: head/sys/net/rtsock.c
==
--- head/sys/net/rtsock.c   Tue May 25 20:35:39 2010(r208552)
+++ head/sys/net/rtsock.c   Tue May 25 20:42:35 2010(r208553)
@@ -55,6 +55,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -673,12 +674,22 @@ route_output(struct mbuf *m, struct sock
 * another search to retrieve the prefix route of
 * the local end point of the PPP link.
 */
-   if ((rtm->rtm_flags & RTF_ANNOUNCE) &&
-   (rt->rt_ifp->if_flags & IFF_POINTOPOINT)) {
+   if (rtm->rtm_flags & RTF_ANNOUNCE) {
struct sockaddr laddr;
-   rt_maskedcopy(rt->rt_ifa->ifa_addr,
- &laddr,
- rt->rt_ifa->ifa_netmask);
+
+   if (rt->rt_ifp != NULL && 
+   rt->rt_ifp->if_type == IFT_PROPVIRTUAL) {
+   struct ifaddr *ifa;
+
+   ifa = ifa_ifwithnet(info.rti_info[RTAX_DST], 1);
+   if (ifa != NULL)
+   rt_maskedcopy(ifa->ifa_addr,
+ &laddr,
+