Mailing List Archive

802.1q vlan questions
Dear All,

I have a question about how to sync the interface infos via netlink while adding a new vlan module on linux machine. The initial runnning config I have is as follows,

Current configuration:
!
hostname Router
!
interface lo
ip address 127.0.0.1/8
!
interface sw0
ip address 192.168.8.120/25
!
ip route 0.0.0.0/0 192.168.8.1
!

After creating a new vlan 2 and setting its ip 130.233.235.1/24 through the attached CLI, it looks fine and "ifconfig" shows,

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 iB) TX bytes:0 (0.0 iB)

sw0 Link encap:Ethernet HWaddr 00:90:27:57:1B:00
inet addr:192.168.8.120 Bcast:192.168.8.127 Mask:255.255.255.128
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:0 (0.0 iB) TX bytes:0 (0.0 iB)
Interrupt:2 Base address:0xe000

sw0.2 Link encap:Ethernet HWaddr 00:90:27:57:1B:00
inet addr:130.233.235.1 Bcast:130.233.235.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 iB) TX bytes:0 (0.0 iB)

However, the running config becomes,

Current configuration:
!
hostname Router
!
interface lo
ip address 127.0.0.1/8
!
interface sw0
ip address 192.168.8.120/25
ip address 130.233.235.1/24
!
interface sw0.2
!
ip route 0.0.0.0/0 192.168.8.1
!

It should configure vlan 2 (sw0.2)'s ip address, not vlan 1 (sw0)'s ip address. Did I miss something?
It is highly appreciated that if any of you could kindly help me out.

Thank you so much!


Mike


------------------------------------------------------------------------------------------
DEFUN (zebra_interface_vlan,
zebra_interface_vlan_cmd,
"interface vlan VLAN-ID",
"Select an interface to configure\n"
"Select a vlan to configure\n"
"Vlan's id\n")
{
int fd;
struct vlan_ioctl_args if_request;
struct interface * ifp; // 11/03/03 mikeliu
char vlan_name[20]; // 11/03/03 mikeliu
char* cmd = "add"; // ADD_VLAN_CMD
char* if_name = "sw0";
unsigned int vid = 0;
char* conf_file_name = "/proc/net/vlan/config";

memset(&if_request, 0, sizeof(struct vlan_ioctl_args));

if(strlen(if_name) > 15) {
vty_out(vty, "ERROR: if_name must be 15 characters or less.%s", VTY_NEWLINE);
return CMD_WARNING;
}
strcpy(if_request.device1, if_name);

vid = atoi(argv[0]);
if_request.u.VID = vid;

// 11/03/03 mikeliu
if (vid == 1)
sprintf(vlan_name, "%s", if_name);
else
sprintf(vlan_name, "%s.%d", if_name, vid);

ifp = if_lookup_by_name (vlan_name);

if (ifp == NULL || ! CHECK_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE))
{
if (ifp == NULL){

// Open up the /proc/vlan/config
if ((fd = open(conf_file_name, O_RDONLY)) < 0) {
vty_out(vty, "WARNING: Could not open /proc/net/vlan/config. Maybe you need to load the 8021q module, or maybe you are not using PROCFS??%s", VTY_NEWLINE);
}
else {
close(fd);
}

/* We use sockets now, instead of the file descriptor */
if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
vty_out(vty, "FATAL: Couldn't open a socket..go figure!%s", VTY_NEWLINE);
}

/* add */
if (strcasecmp(cmd, "add") == 0) {
if_request.cmd = ADD_VLAN_CMD;
if (ioctl(fd, SIOCSIFVLAN, &if_request) < 0) {
vty_out(vty, "ERROR: trying to add VLAN #%u to IF -:%s:- error: %s%s", vid, if_name, strerror(errno), VTY_NEWLINE);
} else {

vty_out(vty, "Added VLAN with VID == %u to IF -:%s:- %s", vid, if_name, VTY_NEWLINE);
ifp = if_get_by_name (vlan_name);

/* If new link is added. */
if_add_update(ifp);

}
}
}
}
vty->index = ifp;
vty->node = INTERFACE_NODE;

vty_out(vty, "interface %s's index is %d%s", ifp->name, ifp->ifindex, VTY_NEWLINE);

return CMD_SUCCESS;
}
Re: 802.1q vlan questions [ In reply to ]
On Fri, 9 Jul 2004, mikeliu wrote:

> Dear All,
>
> I have a question about how to sync the interface infos via netlink
> while adding a new vlan module on linux machine. The initial
> runnning config I have is as follows,

> It should configure vlan 2 (sw0.2)'s ip address, not vlan 1 (sw0)'s
> ip address. Did I miss something? It is highly appreciated that if
> any of you could kindly help me out.

Try using the vlanX naming style, or any other naming style allowed
by vlans.

It's possibly a bug in whatever VLAN layer you're using though,
possibly setting IFLA_IFNAME to sw0 rather than sw0.1. Otherwise it's
a bug in lib/if.c::if_cmp_func which potentially has been fixed in
CVS, see [quagga-dev 1308]


> Thank you so much!
>
>
> Mike
>
>
> ------------------------------------------------------------------------------------------
> DEFUN (zebra_interface_vlan,
> zebra_interface_vlan_cmd,
> "interface vlan VLAN-ID",
> "Select an interface to configure\n"
> "Select a vlan to configure\n"
> "Vlan's id\n")
> {

interesting ;)

> int fd;
> struct vlan_ioctl_args if_request;
> struct interface * ifp; // 11/03/03 mikeliu
> char vlan_name[20]; // 11/03/03 mikeliu
> char* cmd = "add"; // ADD_VLAN_CMD
> char* if_name = "sw0";
> unsigned int vid = 0;
> char* conf_file_name = "/proc/net/vlan/config";
>
> memset(&if_request, 0, sizeof(struct vlan_ioctl_args));
>
> if(strlen(if_name) > 15) {
> vty_out(vty, "ERROR: if_name must be 15 characters or less.%s", VTY_NEWLINE);
> return CMD_WARNING;
> }
> strcpy(if_request.device1, if_name);
>
> vid = atoi(argv[0]);
> if_request.u.VID = vid;
>
> // 11/03/03 mikeliu
> if (vid == 1)
> sprintf(vlan_name, "%s", if_name);
> else
> sprintf(vlan_name, "%s.%d", if_name, vid);
>
> ifp = if_lookup_by_name (vlan_name);
>
> if (ifp == NULL || ! CHECK_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE))
> {
> if (ifp == NULL){
>
> // Open up the /proc/vlan/config
> if ((fd = open(conf_file_name, O_RDONLY)) < 0) {
> vty_out(vty, "WARNING: Could not open /proc/net/vlan/config. Maybe you need to load the 8021q module, or maybe you are not using PROCFS??%s", VTY_NEWLINE);
> }
> else {
> close(fd);
> }
>
> /* We use sockets now, instead of the file descriptor */
> if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
> vty_out(vty, "FATAL: Couldn't open a socket..go figure!%s", VTY_NEWLINE);
> }
>
> /* add */
> if (strcasecmp(cmd, "add") == 0) {
> if_request.cmd = ADD_VLAN_CMD;
> if (ioctl(fd, SIOCSIFVLAN, &if_request) < 0) {
> vty_out(vty, "ERROR: trying to add VLAN #%u to IF -:%s:- error: %s%s", vid, if_name, strerror(errno), VTY_NEWLINE);
> } else {
>
> vty_out(vty, "Added VLAN with VID == %u to IF -:%s:- %s", vid, if_name, VTY_NEWLINE);
> ifp = if_get_by_name (vlan_name);
>
> /* If new link is added. */
> if_add_update(ifp);
>
> }
> }
> }
> }
> vty->index = ifp;
> vty->node = INTERFACE_NODE;
>
> vty_out(vty, "interface %s's index is %d%s", ifp->name, ifp->ifindex, VTY_NEWLINE);
>
> return CMD_SUCCESS;
> }

I'm not sure we want to go down the road of configuring vlans
though...

regards,
--
Paul Jakma paul@clubi.ie paul@jakma.org Key ID: 64A2FF6A
warning: do not ever send email to spam@dishone.st
Fortune:
Eat right, stay fit, and die anyway.
Re: 802.1q vlan questions [ In reply to ]
----- Original Message -----
From: "Paul Jakma" <paul@clubi.ie>
To: "mikeliu" <mikeliu@nmi.iii.org.tw>
Cc: <quagga-dev@lists.quagga.net>
Sent: Friday, July 09, 2004 10:22 PM
Subject: [quagga-dev 1344] Re: 802.1q vlan questions


> On Fri, 9 Jul 2004, mikeliu wrote:
>
> > Dear All,
> >
> > I have a question about how to sync the interface infos via netlink
> > while adding a new vlan module on linux machine. The initial
> > runnning config I have is as follows,
>
> > It should configure vlan 2 (sw0.2)'s ip address, not vlan 1 (sw0)'s
> > ip address. Did I miss something? It is highly appreciated that if
> > any of you could kindly help me out.
>
> Try using the vlanX naming style, or any other naming style allowed
> by vlans.
>
> It's possibly a bug in whatever VLAN layer you're using though,
> possibly setting IFLA_IFNAME to sw0 rather than sw0.1.

VLAN layer seems correct because "ifconfig" shows interface info correctly.

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 iB) TX bytes:0 (0.0 iB)

sw0 Link encap:Ethernet HWaddr 00:90:27:57:1B:00
inet addr:192.168.8.120 Bcast:192.168.8.127 Mask:255.255.255.128
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:0 (0.0 iB) TX bytes:0 (0.0 iB)
Interrupt:2 Base address:0xe000

sw0.2 Link encap:Ethernet HWaddr 00:90:27:57:1B:00
inet addr:130.233.235.1 Bcast:130.233.235.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 iB) TX bytes:0 (0.0 iB)

>Otherwise it's
> a bug in lib/if.c::if_cmp_func which potentially has been fixed in
> CVS, see [quagga-dev 1308]

Before configuring ip info on a newly created vlan interface, switching
among different vlans works fine. It possibly means if_lookup_by_name is
okey. However, after configuing ip info on vlan 2, "show interface" shows 2
interface sw0 as follows and zlog shows "000/01/01 00:01:58 ZEBRA: interface
sw0.2 is still created by netlink!". This log info is really stange since
interface sw0.2 should already exist.

int netlink_link_change (struct sockaddr_nl *snl, struct nlmsghdr *h){
...
...
/* Add interface. */
if (h->nlmsg_type == RTM_NEWLINK)
{
ifp = if_lookup_by_name (name);

if (ifp == NULL || ! CHECK_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE))
{
if (ifp == NULL){
ifp = if_get_by_name (name);
zlog (NULL, LOG_WARNING, "interface %s is still created by
netlink!", ifp->name); //mikeliu debug
printf("interface %s is created by netlink!\n", ifp->name);
}
ifp->ifindex = ifi->ifi_index;
ifp->flags = ifi->ifi_flags & 0x0000fffff;
ifp->mtu = *(int *)RTA_DATA (tb[IFLA_MTU]);
ifp->metric = 1;

/* If new link is added. */
if_add_update(ifp);
}
...
}


Router# sh interface
Interface lo
index 1 metric 1 mtu 16436 <UP,LOOPBACK,RUNNING>
interface is up
input packets 0, bytes 0, dropped 0, multicast packets 0
input errors 0, length 0, overrun 0, CRC 0, frame 0, fifo 0, missed 0
output packets 0, bytes 0, dropped 0
output errors 0, aborted 0, carrier 0, fifo 0, heartbeat 0, window 0
collisions 0
Interface sw0
index 2 metric 1 mtu 1500 <UP,BROADCAST,RUNNING,MULTICAST>
HWaddr: 00:90:27:57:1b:00
interface is up
input packets 0, bytes 0, dropped 0, multicast packets 0
input errors 0, length 0, overrun 0, CRC 0, frame 0, fifo 0, missed 0
output packets 0, bytes 0, dropped 0
output errors 0, aborted 0, carrier 0, fifo 0, heartbeat 0, window 0
collisions 0
Interface sw0
index 3 metric 1 mtu 1500 <UP,BROADCAST,RUNNING,MULTICAST>
interface is up
input packets 0, bytes 0, dropped 0, multicast packets 0
input errors 0, length 0, overrun 0, CRC 0, frame 0, fifo 0, missed 0
output packets 0, bytes 0, dropped 0
output errors 0, aborted 0, carrier 0, fifo 0, heartbeat 0, window 0
collisions 0
Interface sw0.2
index 3 metric 1 mtu 1500 <UP,BROADCAST,RUNNING,MULTICAST>
interface is up
input packets 0, bytes 0, dropped 0, multicast packets 0
input errors 0, length 0, overrun 0, CRC 0, frame 0, fifo 0, missed 0
output packets 0, bytes 0, dropped 0
output errors 0, aborted 0, carrier 0, fifo 0, heartbeat 0, window 0
collisions 0


Any other clues are highly appreciated!

ps. if_cmp_func wasn't used by this CLI.


> > Thank you so much!
> >
> >
> > Mike
> >
> >
>
> --------------------------------------------------------------------------
----------------
> > DEFUN (zebra_interface_vlan,
> > zebra_interface_vlan_cmd,
> > "interface vlan VLAN-ID",
> > "Select an interface to configure\n"
> > "Select a vlan to configure\n"
> > "Vlan's id\n")
> > {
>
> interesting ;)
>
> > int fd;
> > struct vlan_ioctl_args if_request;
> > struct interface * ifp; // 11/03/03 mikeliu
> > char vlan_name[20]; // 11/03/03 mikeliu
> > char* cmd = "add"; // ADD_VLAN_CMD
> > char* if_name = "sw0";
> > unsigned int vid = 0;
> > char* conf_file_name = "/proc/net/vlan/config";
> >
> > memset(&if_request, 0, sizeof(struct vlan_ioctl_args));
> >
> > if(strlen(if_name) > 15) {
> > vty_out(vty, "ERROR: if_name must be 15 characters or less.%s",
VTY_NEWLINE);
> > return CMD_WARNING;
> > }
> > strcpy(if_request.device1, if_name);
> >
> > vid = atoi(argv[0]);
> > if_request.u.VID = vid;
> >
> > // 11/03/03 mikeliu
> > if (vid == 1)
> > sprintf(vlan_name, "%s", if_name);
> > else
> > sprintf(vlan_name, "%s.%d", if_name, vid);
> >
> > ifp = if_lookup_by_name (vlan_name);
> >
> > if (ifp == NULL || ! CHECK_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE))
> > {
> > if (ifp == NULL){
> >
> > // Open up the /proc/vlan/config
> > if ((fd = open(conf_file_name, O_RDONLY)) < 0) {
> > vty_out(vty, "WARNING: Could not open
/proc/net/vlan/config. Maybe you need to load the 8021q module, or
maybe you are not using PROCFS??%s", VTY_NEWLINE);
> > }
> > else {
> > close(fd);
> > }
> >
> > /* We use sockets now, instead of the file descriptor */
> > if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
> > vty_out(vty, "FATAL: Couldn't open a socket..go figure!%s",
VTY_NEWLINE);
> > }
> >
> > /* add */
> > if (strcasecmp(cmd, "add") == 0) {
> > if_request.cmd = ADD_VLAN_CMD;
> > if (ioctl(fd, SIOCSIFVLAN, &if_request) < 0) {
> > vty_out(vty, "ERROR: trying to add VLAN #%u to IF -:%s:-
error: %s%s", vid, if_name, strerror(errno), VTY_NEWLINE);
> > } else {
> >
> > vty_out(vty, "Added VLAN with VID == %u to IF -:%s:- %s",
vid, if_name, VTY_NEWLINE);
> > ifp = if_get_by_name (vlan_name);
> >
> > /* If new link is added. */
> > if_add_update(ifp);
> >
> > }
> > }
> > }
> > }
> > vty->index = ifp;
> > vty->node = INTERFACE_NODE;
> >
> > vty_out(vty, "interface %s's index is %d%s", ifp->name, ifp->ifindex,
VTY_NEWLINE);
> >
> > return CMD_SUCCESS;
> > }
>
> I'm not sure we want to go down the road of configuring vlans
> though...
>
> regards,
> --
> Paul Jakma paul@clubi.ie paul@jakma.org Key ID: 64A2FF6A
> warning: do not ever send email to spam@dishone.st
> Fortune:
> Eat right, stay fit, and die anyway.
> _______________________________________________
> Quagga-dev mailing list
> Quagga-dev@lists.quagga.net
> http://lists.quagga.net/mailman/listinfo/quagga-dev
Re: 802.1q vlan questions [ In reply to ]
On Mon, 12 Jul 2004, mikeliu wrote:

> VLAN layer seems correct because "ifconfig" shows interface info correctly.

what does the 'ip' utility say? 'ip address'.

> Before configuring ip info on a newly created vlan interface,
> switching among different vlans works fine. It possibly means
> if_lookup_by_name is okey. However, after configuing ip info on
> vlan 2, "show interface" shows 2 interface sw0 as follows and zlog

How did you compile Quagga btw?

> shows "000/01/01 00:01:58 ZEBRA: interface sw0.2 is still created
> by netlink!". This log info is really stange since interface sw0.2
> should already exist.

Ah..

> Any other clues are highly appreciated!

Dont have any really.

Can you enable 'debug zebra kernel' and get output of what netlink is
sending for these interfaces?

regards,
--
Paul Jakma paul@clubi.ie paul@jakma.org Key ID: 64A2FF6A
warning: do not ever send email to spam@dishone.st
Fortune:
"Does it worry you that you don't talk any kind of sense? "
Re: 802.1q vlan questions [ In reply to ]
----- Original Message -----
From: "Paul Jakma" <paul@clubi.ie>
To: "mikeliu" <mikeliu@nmi.iii.org.tw>
Cc: <quagga-dev@lists.quagga.net>
Sent: Monday, July 12, 2004 9:59 PM
Subject: [quagga-dev 1349] Re: 802.1q vlan questions


> On Mon, 12 Jul 2004, mikeliu wrote:
>
> > VLAN layer seems correct because "ifconfig" shows interface info
correctly.
>
> what does the 'ip' utility say? 'ip address'.


'ip address' says,

1: lo: <LOOPBACK,UP> mtu 16436 qdisc noqueue
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope global lo
2: sw0: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 100
link/ether 00:90:27:57:1b:00 brd ff:ff:ff:ff:ff:ff
inet 192.168.8.120/25 brd 192.168.8.127 scope global sw0
3: sw0.2: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue
link/ether 00:90:27:57:1b:00 brd ff:ff:ff:ff:ff:ff
inet 130.233.235.1/24 brd 130.233.235.255 scope global sw0.2

> > Before configuring ip info on a newly created vlan interface,
> > switching among different vlans works fine. It possibly means
> > if_lookup_by_name is okey. However, after configuing ip info on
> > vlan 2, "show interface" shows 2 interface sw0 as follows and zlog
>
> How did you compile Quagga btw?

use mips_fp_be-gcc cross compiler for IDT32332 CPU.

> > shows "000/01/01 00:01:58 ZEBRA: interface sw0.2 is still created
> > by netlink!". This log info is really stange since interface sw0.2
> > should already exist.
>
> Ah..
>
> > Any other clues are highly appreciated!
>
> Dont have any really.
>
> Can you enable 'debug zebra kernel' and get output of what netlink is
> sending for these interfaces?

Enable 'debug zebra kernel', then create a new vlan interface(vlan 2) and
configure ip info(130.233.235.1/24) on it.
zlog says,

2000/01/01 00:00:18 ZEBRA: ip:0 netmask:0 next_hop:c0a80801 ifindex:0 type:1
2000/01/01 00:08:02 ZEBRA: interface sw0.2 index 0 becomes active.
2000/01/01 00:08:02 ZEBRA: netlink_parse_info: netlink-listen type
RTM_NEWLINK(1
6), seq=0, pid=0

2000/01/01 00:08:07 ZEBRA: netlink_talk: netlink-cmd type RTM_NEWADDR(20),
seq=7

2000/01/01 00:08:07 ZEBRA: netlink_parse_info: netlink-cmd ACK:
type=RTM_NEWADDR
(20), seq=7, pid=0
2000/01/01 00:08:07 ZEBRA: netlink_parse_info: netlink-listen type
RTM_NEWLINK(1
6), seq=0, pid=0
2000/01/01 00:08:07 ZEBRA: interface sw0.2 is still created by netlink!
2000/01/01 00:08:07 ZEBRA: interface sw0.2 index 3 becomes active.
2000/01/01 00:08:07 ZEBRA: netlink_parse_info: netlink-listen type
RTM_NEWLINK(1
6), seq=0, pid=0
2000/01/01 00:08:07 ZEBRA: netlink_parse_info: netlink-listen type
RTM_NEWADDR(2
0), seq=0, pid=0
2000/01/01 00:08:07 ZEBRA: netlink_parse_info: netlink-listen type
RTM_NEWROUTE(
24), seq=0, pid=0
2000/01/01 00:08:07 ZEBRA: RTM_NEWROUTE ipv4 multicast proto kernel
2000/01/01 00:08:07 ZEBRA: netlink_parse_info: netlink-listen type
RTM_NEWROUTE(
24), seq=0, pid=0
2000/01/01 00:08:07 ZEBRA: RTM_NEWROUTE ipv4 multicast proto kernel
2000/01/01 00:08:07 ZEBRA: netlink_parse_info: netlink-listen type
RTM_NEWROUTE(
24), seq=0, pid=0
2000/01/01 00:08:07 ZEBRA: RTM_NEWROUTE ipv4 unicast proto kernel
2000/01/01 00:08:07 ZEBRA: netlink_parse_info: netlink-listen type
RTM_NEWROUTE(
24), seq=0, pid=0
2000/01/01 00:08:07 ZEBRA: RTM_NEWROUTE ipv4 multicast proto kernel


Really don't know why interface sw0.2 can be created by netlink since
if_lookup_by_name seems works fine.

Thank you so much for your kindly assistance!


Mike
Re: 802.1q vlan questions [ In reply to ]
On Tue, 13 Jul 2004, mikeliu wrote:

> 'ip address' says,
>
> 1: lo: <LOOPBACK,UP> mtu 16436 qdisc noqueue
> link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
> inet 127.0.0.1/8 scope global lo
> 2: sw0: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 100
> link/ether 00:90:27:57:1b:00 brd ff:ff:ff:ff:ff:ff
> inet 192.168.8.120/25 brd 192.168.8.127 scope global sw0
> 3: sw0.2: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue
> link/ether 00:90:27:57:1b:00 brd ff:ff:ff:ff:ff:ff
> inet 130.233.235.1/24 brd 130.233.235.255 scope global sw0.2

Ok..

>> How did you compile Quagga btw?
>
> use mips_fp_be-gcc cross compiler for IDT32332 CPU.

Unusual :)

With what configure options though?

> Enable 'debug zebra kernel', then create a new vlan interface(vlan 2) and
> configure ip info(130.233.235.1/24) on it.
> zlog says,
>
> 2000/01/01 00:00:18 ZEBRA: ip:0 netmask:0 next_hop:c0a80801 ifindex:0 type:1
> 2000/01/01 00:08:02 ZEBRA: interface sw0.2 index 0 becomes active.
^^^^^^^^^^^^^

sw0.2 index 0? What were the logs immediately before this? Can you
post all relevant logs pertaining to both sw0 and sw0.2?

> 2000/01/01 00:08:02 ZEBRA: netlink_parse_info: netlink-listen type
> RTM_NEWLINK(1
> 6), seq=0, pid=0
>
> 2000/01/01 00:08:07 ZEBRA: netlink_talk: netlink-cmd type RTM_NEWADDR(20),
> seq=7
>
> 2000/01/01 00:08:07 ZEBRA: netlink_parse_info: netlink-cmd ACK:
> type=RTM_NEWADDR
> (20), seq=7, pid=0
> 2000/01/01 00:08:07 ZEBRA: netlink_parse_info: netlink-listen type
> RTM_NEWLINK(1
> 6), seq=0, pid=0
> 2000/01/01 00:08:07 ZEBRA: interface sw0.2 is still created by netlink!
> 2000/01/01 00:08:07 ZEBRA: interface sw0.2 index 3 becomes active.

and then RTM_NEWLINK _again_, presumably above there was already an
RTM_NEWLINK for sw0.2 shortly before the first log message, for
sw0.2?

> Really don't know why interface sw0.2 can be created by netlink
> since if_lookup_by_name seems works fine.

My bets are still on a mistake in the sw or else vlan driver you are
using. Afaik, regular Linux ethX drivers and the vlan layer work
fine.

> Thank you so much for your kindly assistance!

no worries.

> Mike

regards,
--
Paul Jakma paul@clubi.ie paul@jakma.org Key ID: 64A2FF6A
warning: do not ever send email to spam@dishone.st
Fortune:
It gets late early out there.
-- Yogi Berra
Re: 802.1q vlan questions [ In reply to ]
On Tue, 13 Jul 2004, mikeliu wrote:

> 'ip address' says,
>
> 1: lo: <LOOPBACK,UP> mtu 16436 qdisc noqueue
> link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
> inet 127.0.0.1/8 scope global lo
> 2: sw0: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 100
> link/ether 00:90:27:57:1b:00 brd ff:ff:ff:ff:ff:ff
> inet 192.168.8.120/25 brd 192.168.8.127 scope global sw0
> 3: sw0.2: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue
> link/ether 00:90:27:57:1b:00 brd ff:ff:ff:ff:ff:ff
> inet 130.233.235.1/24 brd 130.233.235.255 scope global sw0.2

Ok..

>> How did you compile Quagga btw?
>
> use mips_fp_be-gcc cross compiler for IDT32332 CPU.

Unusual :)

With what configure options though?

./configure --build=i686-pc-linux-gnu --host=mips-unknown-linux-gnu --disable-ipv6 --disable-bgpd --enable-vtysh

> Enable 'debug zebra kernel', then create a new vlan interface(vlan 2) and
> configure ip info(130.233.235.1/24) on it.
> zlog says,
>
> 2000/01/01 00:00:18 ZEBRA: ip:0 netmask:0 next_hop:c0a80801 ifindex:0 type:1
> 2000/01/01 00:08:02 ZEBRA: interface sw0.2 index 0 becomes active.
^^^^^^^^^^^^^

sw0.2 index 0? What were the logs immediately before this? Can you
post all relevant logs pertaining to both sw0 and sw0.2?


Turn on both 'debug zebra kernel' and 'debug zebra event', then create a new vlan 2 and configuer ip info on it. All of the zlogs are as follows.

------------------------------------------------------------------------------------------------------------------------------------------------------
2000/01/01 00:00:18 ZEBRA: ip:0 netmask:0 next_hop:c0a80801 ifindex:0 type:1
2000/01/01 00:00:37 ZEBRA: MESSAGE: ZEBRA_INTERFACE_ADD sw0.2
2000/01/01 00:00:37 ZEBRA: interface sw0.2 index 0 becomes active.
2000/01/01 00:00:37 ZEBRA: netlink_parse_info: netlink-listen type RTM_NEWLINK(1
6), seq=0, pid=0

2000/01/01 00:00:42 ZEBRA: MESSAGE: ZEBRA_INTERFACE_UP sw0.2
2000/01/01 00:00:42 ZEBRA: netlink_talk: netlink-cmd type RTM_NEWADDR(20), seq=7

2000/01/01 00:00:42 ZEBRA: netlink_parse_info: netlink-cmd ACK: type=RTM_NEWADDR
(20), seq=7, pid=0
2000/01/01 00:00:42 ZEBRA: MESSAGE: ZEBRA_INTERFACE_ADDRESS_ADD 130.233.235.1/24
on sw0
2000/01/01 00:00:42 ZEBRA: netlink_parse_info: netlink-listen type RTM_NEWLINK(1
6), seq=0, pid=0
2000/01/01 00:00:42 ZEBRA: interface sw0.2 is still created by netlink!
2000/01/01 00:00:42 ZEBRA: MESSAGE: ZEBRA_INTERFACE_ADD sw0.2
2000/01/01 00:00:42 ZEBRA: interface sw0.2 index 3 becomes active.
2000/01/01 00:00:42 ZEBRA: netlink_parse_info: netlink-listen type RTM_NEWLINK(1
6), seq=0, pid=0
2000/01/01 00:00:42 ZEBRA: netlink_parse_info: netlink-listen type RTM_NEWADDR(2
0), seq=0, pid=0
2000/01/01 00:00:42 ZEBRA: netlink_parse_info: netlink-listen type RTM_NEWROUTE(
24), seq=0, pid=0
2000/01/01 00:00:42 ZEBRA: RTM_NEWROUTE ipv4 multicast proto kernel
2000/01/01 00:00:42 ZEBRA: netlink_parse_info: netlink-listen type RTM_NEWROUTE(
24), seq=0, pid=0
2000/01/01 00:00:42 ZEBRA: RTM_NEWROUTE ipv4 multicast proto kernel
2000/01/01 00:00:42 ZEBRA: netlink_parse_info: netlink-listen type RTM_NEWROUTE(
24), seq=0, pid=0
2000/01/01 00:00:42 ZEBRA: RTM_NEWROUTE ipv4 unicast proto kernel
2000/01/01 00:00:42 ZEBRA: netlink_parse_info: netlink-listen type RTM_NEWROUTE(
24), seq=0, pid=0
2000/01/01 00:00:43 ZEBRA: RTM_NEWROUTE ipv4 multicast proto kernel
---------------------------------------------------------------------------------------------------------------------------------------------------------

> 2000/01/01 00:08:02 ZEBRA: netlink_parse_info: netlink-listen type
> RTM_NEWLINK(1
> 6), seq=0, pid=0
>
> 2000/01/01 00:08:07 ZEBRA: netlink_talk: netlink-cmd type RTM_NEWADDR(20),
> seq=7
>
> 2000/01/01 00:08:07 ZEBRA: netlink_parse_info: netlink-cmd ACK:
> type=RTM_NEWADDR
> (20), seq=7, pid=0
> 2000/01/01 00:08:07 ZEBRA: netlink_parse_info: netlink-listen type
> RTM_NEWLINK(1
> 6), seq=0, pid=0
> 2000/01/01 00:08:07 ZEBRA: interface sw0.2 is still created by netlink!
> 2000/01/01 00:08:07 ZEBRA: interface sw0.2 index 3 becomes active.

and then RTM_NEWLINK _again_, presumably above there was already an
RTM_NEWLINK for sw0.2 shortly before the first log message, for
sw0.2?

Don't know why it has 2 RTM_NEWLINK and the log "2000/01/01 00:00:42 ZEBRA: MESSAGE: ZEBRA_INTERFACE_ADDRESS_ADD 130.233.235.1/24 on sw0" is unusual.


Thanks again!


Mike

> Really don't know why interface sw0.2 can be created by netlink
> since if_lookup_by_name seems works fine.

My bets are still on a mistake in the sw or else vlan driver you are
using. Afaik, regular Linux ethX drivers and the vlan layer work
fine.