Bug 8786

Summary: rp3 "-i" and startup problems
Product: [Retired] Red Hat Linux Reporter: Jeff Norden <jeff>
Component: rp3Assignee: Nalin Dahyabhai <nalin>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6.1CC: jeff
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2000-04-06 20:37:23 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jeff Norden 2000-01-24 03:41:58 UTC
The diffs below fix some minor startup problems with rp3.  They are against
the source from *version 1.0.5*, which is the current "rawhide" edition.

1) The first diff is for rp3/properties.c:  Currently, when an interface is
specified with the -i flag, a window is opened but ppp is *not* started
until you click on it.  The diff makes "-i" behave exactly as if the
corresponding interface had been chosen from the initial menu, so that the
interface will automatically start.

2) The second diff is for rp3/display.c:  Currently, rp3 asks to confirm
starting an interface the first time.  This seems kind of silly when we
have just chosen which interface to start from the initial menu.
Currently, by default, rp3 will hang-up the modem without confirmation if
it
receives a single-click in its window (this should to be customizable - see
comments below).
The diff is to just reverse these behaviors.  Don't ask for confirmation on
first startup, but ask on single-click requests to disconnect or re-dial.

3) The third diff is for rp3.c: this just adds a little bit to the help
string for the "-i" option, to make clear what "logical name" means.

------------------------------------------------------------

With the below diffs, rp3 does exactly what I want:  I have a desktop icon
linked to the cmd "rp3 -i ppp0".  I double-click on it and my modem starts
dialing immediately.  The rp3 window can then be used to hang-up and later
re-dial, but asks for confirmation so that an accidental click won't
disconnect me.

------------------------------------------------------------
Other Comments/Suggestions:

-i only accepts the logical interface name.  It would be nice if it (or
some
other option) accepted "friendly" interface names.

It would be good if the interface_new() routine (in interface.c) could
check whether an interface really exists.  Right now "rp3 -i foobar" brings
up a useless window titled "foobar", but it should probably bring up an
error window instead.

It seems that it is *supposed* to be possible to customize whether the user
is asked to confirm starting or stopping an interface, but these settings
don't seem to work.  For one thing they get written into the ~/.gnome/rp3
file with one letter short - i.e., I find
 confirmStar=true
 confirmSto=true
in my file.  Editing the file to add the missing 't' and 'p' causes the
buttons in the properties window to change, but still doesn't change the
behavior of rp3.

IMHO, there should be a three options - confirmStart, confirmRestart, and
confirmStop.  The confirmStart option should only apply when rp3 first
starts up an interface.  The force_ask arg to display_set_status_by_app()
would then be replaced by an argument called something like restart_flag,
to
tell the subroutine whether to look at the value of confirmStart or
confirmRestart.  The default should be confirmStart=false and
confirmRestart=confirmStop=true, which is equivalent to what my display.c
patch does.

============================================================
diff -rc rp3-1.0.5-orig/rp3/properties.c rp3-1.0.5/rp3/properties.c
*** rp3-1.0.5-orig/rp3/properties.c	Tue Nov  9 16:28:11 1999
--- rp3-1.0.5/rp3/properties.c	Sun Jan 23 01:44:18 2000
***************
*** 46,60 ****
  properties_interface_get(char *chosenInterface) {
      interface *i = NULL;

!     if (!chosenInterface) {
! 	i = properties_interface_choose();
! 	if (!i) return NULL;
! 	chosenInterface = i->logicalName;
! 	if (i->manipulable && i->status == INTERFACE_DOWN)
! 	    display_set_interface_startup_query(i);
!     }

!     return interface_new(chosenInterface);
  }

  /* offers list of existing interfaces (if any) and the option
--- 46,62 ----
  properties_interface_get(char *chosenInterface) {
      interface *i = NULL;

!     if (!chosenInterface)
!       i = properties_interface_choose();
!     else
!       i= interface_new(chosenInterface);

!     if (!i) return NULL;
!
!     if (i->manipulable && i->status == INTERFACE_DOWN)
!       display_set_interface_startup_query(i);
!
!     return(i);
  }

  /* offers list of existing interfaces (if any) and the option
diff -rc rp3-1.0.5-orig/rp3/display.c rp3-1.0.5/rp3/display.c
*** rp3-1.0.5-orig/rp3/display.c	Tue Nov  9 16:28:11 1999
--- rp3-1.0.5/rp3/display.c	Sun Jan 23 01:44:18 2000
***************
*** 423,429 ****
      app = gtk_object_get_user_data(GTK_OBJECT(netmon));
      assert(app);

!     display_set_status_by_app(app, 0);
  }

  void
--- 423,429 ----
      app = gtk_object_get_user_data(GTK_OBJECT(netmon));
      assert(app);

!     display_set_status_by_app(app, 1);
  }

  void
***************
*** 597,603 ****
      interfaceList = g_slist_prepend(interfaceList, netmon);

      if (autoStart) {
! 	display_set_status_by_app(app, 1);
      }

      return netmon;
--- 597,603 ----
      interfaceList = g_slist_prepend(interfaceList, netmon);

      if (autoStart) {
! 	display_set_status_by_app(app, 0);
      }

      return netmon;
diff -rc rp3-1.0.5-orig/rp3/rp3.c rp3-1.0.5/rp3/rp3.c
*** rp3-1.0.5-orig/rp3/rp3.c	Fri Sep 24 19:00:51 1999
--- rp3-1.0.5/rp3/rp3.c	Sun Jan 23 01:51:04 2000
***************
*** 37,43 ****
  static char *chosenTitle = NULL;
  static struct poptOption options[] = {
      { "interface", 'i', POPT_ARG_STRING, &chosenInterface, 0,
!       N_("logical name of interface to use"), N_("INTERFACE")},
      { "swallow", '\0', POPT_ARG_STRING, &chosenTitle, 0,
        N_("set window title for swallowing"), N_("WINDOW-TITLE")},
  };
--- 37,43 ----
  static char *chosenTitle = NULL;
  static struct poptOption options[] = {
      { "interface", 'i', POPT_ARG_STRING, &chosenInterface, 0,
!       N_("logical name of interface to use (eg, ppp0)"),
N_("INTERFACE")},
      { "swallow", '\0', POPT_ARG_STRING, &chosenTitle, 0,
        N_("set window title for swallowing"), N_("WINDOW-TITLE")},
  };

Comment 1 Nalin Dahyabhai 2000-02-01 15:36:59 UTC
Thanks, the third patch has been applied.  As for the first, I'm not so sure
that this is the right behavior.  It's entirely possible that rp3 would be
started as an applet, and toggling an interface up or down when you log in
or out can be disruptive, especially given that rp3 can monitor ethernet and
other interfaces as well.

I belive the version I'm about to check back into CVS fixes the problems with
saving and retrieving the confirmStart and confirmStop options, so starting
rp3 with the -i option will not request confirmation if confirmStart = no, but
you still have to click to bring the interface up or down.

Bad behavior wrt bogus interface names will also be fixed in CVS.

Comment 2 Nalin Dahyabhai 2000-04-06 20:37:59 UTC
The CVS version mentioned is now included in Red Hat Linux 6.2, as well as in
Raw Hide (ftp://ftp.redhat.com/pub/rawhide/i386/RedHat/RPMS/).