On Fri, Dec 04, 2009 at 09:34:31AM +0200, Vladimir Kirillov wrote:
> Hello t...@!
> 
> Here's a diff for tun to make it keep record and display the
> pid of tunnel owner process in ifconfig.
> I'm sure it would be a handy feature, hope you'll like it.
[dd]
> @@ -561,6 +566,15 @@ tun_ioctl(struct ifnet *ifp, u_long cmd,
>         case SIOCGIFMEDIA:
>         case SIOCSIFMEDIA:
>                 error = ifmedia_ioctl(ifp, ifr, &tp->tun_media, cmd);
> +               break;
> +
> +       case SIOCGTUNPID:
> +               if (tp->tun_proc == NULL) {
> +                       error = ENOTTY;
> +                       break;
> +               }
> +
> +               tunr->tun_pid = tp->tun_proc->p_pid;
>                 break;


Just a personal comment, why not:

+       case SIOCGTUNPID:
+               if (tp->tun_proc == NULL)
+                       error = ENOTTY;
+               else
+                       tunr->tun_pid = tp->tun_proc->p_pid;
                break;

Just so it is more consistent with the rest of the code?

--patrick

Reply via email to