Re: [PATCH] ifconfig hurd: Notify pfinet of interfaces

2022-10-25 Thread Simon Josefsson via Bug reports for the GNU Hurd
Hi.  I have commited this now:
https://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=0b35abbd7a5d074c7e245a49585b2de036d4dec7

/Simon


signature.asc
Description: PGP signature


Re: [PATCH] ifconfig hurd: Notify pfinet of interfaces

2022-10-08 Thread Alfred M. Szmidt
Samuel, your copyright assignment is now on file.



Re: [PATCH] ifconfig hurd: Notify pfinet of interfaces

2022-09-28 Thread jbranso
September 28, 2022 12:25 PM, "Alfred M. Szmidt"  wrote:

> Alfred M. Szmidt, le mer. 28 sept. 2022 11:21:34 -0400, a ecrit:
>>> have you signed copyright assignment papers for InetUtils,
>> 
>> I didn't know there was copyright assignment for InetUtils :/
>> 
>> It has always been the case. The process is a few days in the best of
>> cases, and even if it is a week or more, it doesn't slow down progress
>> much, if at all.
> 
> I have very often seen it take months.
> 
> If it takes that long, please escalate to the FSF clerk and RMS. It
> shouldn't take that long. Once 20 years ago, it did take a while but
> the process is now mostly digital.

I wish it could be as easy as a web based application.



Re: [PATCH] ifconfig hurd: Notify pfinet of interfaces

2022-09-28 Thread Samuel Thibault
Alfred M. Szmidt, le mer. 28 sept. 2022 11:21:34 -0400, a ecrit:
>> have you signed copyright assignment papers for InetUtils,
> 
>I didn't know there was copyright assignment for InetUtils :/
> 
> It has always been the case.  The process is a few days in the best of
> cases, and even if it is a week or more, it doesn't slow down progress
> much, if at all.

I have very often seen it take months.

Samuel



Re: [PATCH] ifconfig hurd: Notify pfinet of interfaces

2022-09-28 Thread Alfred M. Szmidt
We collect as per usual copyright assignments for the GNU network
utilities.  Just as per normal GNU policies.



Re: [PATCH] ifconfig hurd: Notify pfinet of interfaces

2022-09-28 Thread Alfred M. Szmidt


   Alfred M. Szmidt, le mer. 28 sept. 2022 11:21:34 -0400, a ecrit:
   >> have you signed copyright assignment papers for InetUtils,
   > 
   >I didn't know there was copyright assignment for InetUtils :/
   > 
   > It has always been the case.  The process is a few days in the best of
   > cases, and even if it is a week or more, it doesn't slow down progress
   > much, if at all.

   I have very often seen it take months.

If it takes that long, please escalate to the FSF clerk and RMS.  It
shouldn't take that long.  Once 20 years ago, it did take a while but
the process is now mostly digital.



Re: [PATCH] ifconfig hurd: Notify pfinet of interfaces

2022-09-28 Thread Alfred M. Szmidt
   > have you signed copyright assignment papers for InetUtils,

   I didn't know there was copyright assignment for InetUtils :/

It has always been the case.  The process is a few days in the best of
cases, and even if it is a week or more, it doesn't slow down progress
much, if at all.

   I now have sent the form to the clerk, but really, such process slows
   down contributions, particularly if not all code is copyright by FSF.

Thanks.



Re: [PATCH] ifconfig hurd: Notify pfinet of interfaces

2022-09-28 Thread Samuel Thibault
Hello,

Simon Josefsson, le mer. 28 sept. 2022 13:46:52 +0200, a ecrit:
> have you signed copyright assignment papers for InetUtils,

I didn't know there was copyright assignment for InetUtils :/

I now have sent the form to the clerk, but really, such process slows
down contributions, particularly if not all code is copyright by FSF.

Samuel



Re: [PATCH] ifconfig hurd: Notify pfinet of interfaces

2022-09-28 Thread Simon Josefsson via Bug reports for the GNU Hurd
Samuel Thibault  writes:

> Hello,
>
> Simon Josefsson, le mer. 28 sept. 2022 13:46:52 +0200, a ecrit:
>> have you signed copyright assignment papers for InetUtils,
>
> I didn't know there was copyright assignment for InetUtils :/
>
> I now have sent the form to the clerk, but really, such process slows
> down contributions, particularly if not all code is copyright by FSF.

Thank you!

If someone could engage with the FSF on what a suitable copyright
assignment policy for InetUtils would be, that would clarify.  I agree
that requiring copyright assignments for a patch that fixes bugs in code
not owned by the FSF anyway is detrimental to contributions.

/Simon


signature.asc
Description: PGP signature


Re: [PATCH] ifconfig hurd: Notify pfinet of interfaces

2022-09-28 Thread Simon Josefsson via Bug reports for the GNU Hurd
Both your patches looks good to me -- however, have you signed copyright
assignment papers for InetUtils, or how are these contributed?
Generally I'm not sure how useful it is to require copyright assignment
for smaller InetUtils contributions -- the majority of the code is not
copyright by FSF anyway.  If you can sign papers for InetUtils, that
question is not relevant though.

/Simon


signature.asc
Description: PGP signature


[PATCH] ifconfig hurd: Notify pfinet of interfaces

2022-09-26 Thread Samuel Thibault
When the pfinet translator is configured without any initial interface,
ifconfig has to explicitly tell it the interfaces to be configured.
This needs to be done before any SIOC ioctl with that interface name,
thus introducing a system_preconfigure that is called before any other
configuration.

* ifconfig/system.h (system_preconfigure): New prototype.
* ifconfig/system/hurd.c: Include hurd.h, hurd/paths.h, hurd/fsys.h,
argz.h.
(check_driving): New function.
(system_preconfigure): New function.
* ifconfig/system/bsd.c (system_preconfigure): New functions.
* ifconfig/system/generic.c (system_preconfigure): Likewise.
* ifconfig/system/linux.c (system_preconfigure): Likewise.
* ifconfig/system/qnx.c (system_preconfigure): Likewise.
* ifconfig/system/solaris.c (system_preconfigure): Likewise.
* ifconfig/changeif.c (configure_if): Call system_preconfigure before
other "set" functions.

Index: inetutils-2.3/ifconfig/system/hurd.c
===
--- inetutils-2.3.orig/ifconfig/system/hurd.c
+++ inetutils-2.3/ifconfig/system/hurd.c
@@ -24,6 +24,10 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
 #include "../ifconfig.h"
 
 #include 
@@ -34,6 +38,107 @@
 const char *system_default_format = "gnu";
 
 
+/* Check that pfinet is driving the given interface name.  */
+static int
+check_driving (const char *name)
+{
+  file_t node;
+  fsys_t fsys;
+  error_t err;
+
+  char *argz = 0, *new_argz = 0;
+  size_t argz_len = 0;
+  char *entry = 0;
+  const char *socket = _SERVERS_SOCKET "/2";
+
+  int ret = 0;
+
+  if (strcmp (name, "lo") == 0)
+/* Always configured.  */
+return 1;
+
+  node = file_name_lookup (socket, 0, 0666);
+  if (node == MACH_PORT_NULL)
+{
+  error (0, 0, "Interface name %s does not exist", name);
+  return 0;
+}
+
+  file_get_fs_options (node, , _len);
+
+  for (entry = argz; entry; entry = argz_next (argz, argz_len, entry))
+{
+  if (strcmp (entry, "-i") == 0)
+   {
+ char *ifname = argz_next (argz, argz_len, entry);
+
+ if (strcmp (ifname, name) == 0)
+   {
+ /* Already there.  */
+ ret = 1;
+ goto out;
+   }
+   }
+
+  else if (strncmp (entry, "--interface=", 12) == 0)
+   {
+ if (strcmp (entry + 12, name) == 0)
+   {
+ /* Already there.  */
+ ret = 1;
+ goto out;
+   }
+   }
+}
+
+  /* Not already there.  */
+
+  err = file_getcontrol (node, );
+  if (err)
+{
+  if (err == EPERM)
+   error (0, err, "Could not make pfinet %s drive %s", socket, name);
+  else
+   error (0, err, "Could not get control of %s", socket);
+  goto out;
+}
+
+  new_argz = malloc (argz_len);
+  memcpy (new_argz, argz, argz_len);
+
+  err = argz_insert (_argz, _len, new_argz, name);
+  if (err)
+{
+  error (0, err, "Could not prepend name %s to '%s' for %s", name, 
new_argz, socket);
+  goto out;
+}
+
+  err = argz_insert (_argz, _len, new_argz, "-i");
+  if (err)
+{
+  argz_stringify (new_argz, argz_len, ' ');
+  error (0, err, "Could not prepend -i to '%s' for %s", new_argz, socket);
+  goto out;
+}
+
+  err = fsys_set_options (fsys, new_argz, argz_len, 1);
+  if (err)
+{
+  argz_stringify (new_argz, argz_len, ' ');
+  error (0, err, "Could not make pfinet %s drive %s with '%s'", socket, 
name, new_argz);
+  goto out;
+}
+
+  ret = 1;
+
+out:
+  free (new_argz);
+  vm_deallocate (mach_task_self (), (vm_offset_t) argz, argz_len);
+  mach_port_deallocate (mach_task_self (), node);
+
+  return ret;
+}
+
 /* Argument parsing stuff.  */
 
 const char *system_help = "NAME [ADDR]\
@@ -156,6 +261,15 @@ system_parse_opt_rest (struct ifconfig *
   return 0;
 }
 
+int
+system_preconfigure (int sfd MAYBE_UNUSED,
+struct ifreq *ifr MAYBE_UNUSED)
+{
+  if (!check_driving (ifr->ifr_name))
+return -1;
+  return 0;
+}
+
 int
 system_configure (int sfd MAYBE_UNUSED,
  struct ifreq *ifr MAYBE_UNUSED,
Index: inetutils-2.3/ifconfig/changeif.c
===
--- inetutils-2.3.orig/ifconfig/changeif.c
+++ inetutils-2.3/ifconfig/changeif.c
@@ -404,7 +404,8 @@ configure_if (int sfd, struct ifconfig *
   strncpy (ifr.ifr_name, ifp->name, IFNAMSIZ);
   ifr.ifr_name[IFNAMSIZ - 1] = '\0';
 
-  if (ifp->valid & IF_VALID_ADDR)
+  err = system_preconfigure (sfd, );
+  if (!err && ifp->valid & IF_VALID_ADDR)
 err = set_address (sfd, , ifp->address);
   if (!err && ifp->valid & IF_VALID_NETMASK)
 err = set_netmask (sfd, , ifp->netmask);
Index: inetutils-2.3/ifconfig/system.h
===
--- inetutils-2.3.orig/ifconfig/system.h
+++ inetutils-2.3/ifconfig/system.h
@@ -64,6 +64,7 @@ extern const char *system_default_format
 # undef SYSTEM_FORMAT_HANDLER