On Wed, Apr 30, 2008 at 02:01:21PM -0400, Niki Denev wrote:
> Hi,
>
> I've noticed that autoloading of if_vlan.ko on vlan
creation does not
> work in the case when the vlans are specified with the
interface name.
> i.e. : fxp0.5 And the problem is that ifmaybeload() in
ifconfig.c
> expects that all interfaces are in the format :
if_$$,
> which is not the case for vlans created in the above
mentioned way
> (which is much more easier and intuitive IMHO) This
patch fixes this
> for me, and probably others may find it useful.
What is the practical use of this feature? If you don't
have the
module loaded, the rc scripts won't even see the interface
unless
you manually set network_interfaces which has been
documented as a
deprecated configuration since 6.2 and will soon generate
warnings in
7-stable. If you want to use an interface, why not add an
appropriate
entry to /boot/loader.conf and be done with it?
-- Brooks
> P.S.: Because of the assumption for the interface name
that
> ifmaybeload() does, this patch looks more like a hack
and probably a
> better way could be found for handling this case.
P.S2: If "ifconfig
> fxp0." is typed this will autoload if_vlan.ko
because we have a dot
> after the first number in the interface name (there is
no check if
> there are other digits after the dot). I'm not sure if
a more strict
> check is needed though because I can't imagine this can
cause any real
> problems.
>
>
> --- ifconfig.c.orig 2008-04-30 12:29:25.000000000
-0400
> +++ ifconfig.c 2008-04-30 12:44:50.000000000 -0400
>  -935,18 +935,21 
> if (noload)
> return;
>
> - /* trim the interface number off the end */
> + /* locate interface number beginning */
> strlcpy(ifname, name, sizeof(ifname));
> for (dp = ifname; *dp != 0; dp++)
> - if (isdigit(*dp)) {
> - *dp = 0;
> + if (isdigit(*dp))
> break;
> - }
>
> - /* turn interface and unit into module name */
> - strcpy(ifkind, "if_");
> - strlcpy(ifkind + MOD_PREFIX_LEN, ifname,
> - sizeof(ifkind) - MOD_PREFIX_LEN);
> + /* check the special case for vlan interfaces */
> + if (strchr(dp, '.')) {
> + strcpy(ifkind, "if_vlan");
> + } else {
> + /* turn interface and unit into module name
*/
> + strcpy(ifkind, "if_");
> + strlcpy(ifkind + MOD_PREFIX_LEN, ifname,
> + sizeof(ifkind) - MOD_PREFIX_LEN);
> + }
>
> /* scan files in kernel */
> mstat.version = sizeof(struct module_stat);
> --- ifconfig.c.orig 2008-04-30 12:29:25.000000000
-0400
> +++ ifconfig.c 2008-04-30 12:44:50.000000000 -0400
>  -935,18 +935,21 
> if (noload)
> return;
>
> - /* trim the interface number off the end */
> + /* locate interface number beginning */
> strlcpy(ifname, name, sizeof(ifname));
> for (dp = ifname; *dp != 0; dp++)
> - if (isdigit(*dp)) {
> - *dp = 0;
> + if (isdigit(*dp))
> break;
> - }
>
> - /* turn interface and unit into module name */
> - strcpy(ifkind, "if_");
> - strlcpy(ifkind + MOD_PREFIX_LEN, ifname,
> - sizeof(ifkind) - MOD_PREFIX_LEN);
> + /* check the special case for vlan interfaces */
> + if (strchr(dp, '.')) {
> + strcpy(ifkind, "if_vlan");
> + } else {
> + /* turn interface and unit into module name */
> + strcpy(ifkind, "if_");
> + strlcpy(ifkind + MOD_PREFIX_LEN, ifname,
> + sizeof(ifkind) - MOD_PREFIX_LEN);
> + }
>
> /* scan files in kernel */
> mstat.version = sizeof(struct module_stat);
> _______________________________________________
> freebsd-net freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-net
> To unsubscribe, send any mail to
"freebsd-net-unsubscribe freebsd.org"
|