Re: [PATCH v2 2/2] network: add static route support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05/22/14 at 03:33pm, Dave Young wrote:
> On 05/05/14 at 03:12pm, Baoquan He wrote:

> Hi, Baoquan
> 
> The route-$netif is supposed in 1st kernel filesystem. Can we passing the
> detail ip/netmask/gw for specific nic in kernel cmdline instead of copy
> the route file in initramfs? In that way we can avoid this dracut fix.
> 
> I'm not sure if it works for the complicate route setup though.

I am not sure, it had better handle the route during setup net. I want
to hear what Harald will say. He is more familiar with this.

Thanks
Baoquan

> 
> > +    if [ -e "$f" ]; then
> > +        if grep -Eq '^[[:space:]]*ADDRESS[0-9]+=' $f ; then
> > +            handle_file $f $netif
> > +        else
> > +            handle_ip_file $f
> > +        fi
> > +    fi
> > +
> >      # Handle STP Timeout: arping the default gateway.
> >      # (or the root server, if a) it's local or b) there's no gateway.)
> >      # Note: This assumes that if no router is present the
> > @@ -517,6 +527,35 @@ find_iface_with_link() {
> >      return 1
> >  }
> >  
> > +handle_file () {
> > +    . $1
> > +    routenum=0
> > +    while [ "x$(eval echo '$'ADDRESS$routenum)x" != "xx" ]; do
> > +        eval $(ipcalc -p $(eval echo '$'ADDRESS$routenum) $(eval echo '$'NETMASK$routenum))
> > +        line="$(eval echo '$'ADDRESS$routenum)/$PREFIX"
> > +        if [ "x$(eval echo '$'GATEWAY$routenum)x" != "xx" ]; then
> > +            line="$line via $(eval echo '$'GATEWAY$routenum)"
> > +        fi
> > +        line="$line dev $2"
> > +        /sbin/ip route add $line
> > +        routenum=$(($routenum+1))
> > +    done
> > +}
> > +
> > +handle_ip_file() {
> > +    local f t type= file=$1 proto="-4"
> > +    f=${file##*/}
> > +    t=${f%%-*}
> > +    type=${t%%6}
> > +    if [ "$type" != "$t" ]; then
> > +        proto="-6"
> > +    fi
> > +
> > +    while read line; do
> > +        /sbin/ip $proto $type add $line
> > +    done < $file
> > +}
> > +
> >  is_persistent_ethernet_name() {
> >      case "$1" in
> >          # udev persistent interface names
> > -- 
> > 1.9.0
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe initramfs" in
> > the body of a message to majordomo@xxxxxxxxxxxxxxx
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe initramfs" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux