Page MenuHomeFreeBSD

Add support for protocol prefixes in rootpath
AbandonedPublic

Authored by kczekirda on May 22 2017, 12:40 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Oct 31, 3:15 AM
Unknown Object (File)
Fri, Oct 31, 1:07 AM
Unknown Object (File)
Thu, Oct 30, 11:00 PM
Unknown Object (File)
Thu, Oct 30, 10:08 PM
Unknown Object (File)
Thu, Oct 30, 9:48 PM
Unknown Object (File)
Sat, Oct 25, 1:14 AM
Unknown Object (File)
Tue, Oct 21, 6:38 AM
Unknown Object (File)
Sat, Oct 18, 12:50 PM
Subscribers

Details

Summary

If rootpath starts with protocol prefix, then set them.

Sponsored by: Oktawave
Relnote: Yes

Test Plan

valid rootpaths:

"/tftproot"
"192.168.1.1:/tftproot"
"tftp:///tftproot"
"tftp://192.168.1.1:/tftproot"

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

sys/boot/common/dev_net.c
395

I would suggest something a bit more generic;

struct root_path_prefix {

const char *rp_prefix;
int rp_netproto;

}

make an array of the values, and in the code just walk the array based on nitems().

rgrimes added a subscriber: rgrimes.

I have no problem with this code going in as it is here, it can be evolved with a table post commit.

sys/boot/common/dev_net.c
395

I like this idea of array of protocols, but I think we should only walk that if there is a :// in the string, then if we do not find a match in the table return an error that the protocol is not (yet) supported?

This revision is now accepted and ready to land.May 22 2017, 4:19 PM
sys/boot/common/dev_net.c
395

I'd just walk the table, then check ip:/path and then just fall back to tftp (as default). I mean, its not like we will get huge table and the rootpath is set only at the very beginning anyhow.

I don't like the current approach as it is not a valid URI parser

for example with that approach tftp://ip/something will not work
or tftp:/something will not work either.

tftp://192.168.1.1:/tftproot is weird

I would accept tftp://<ip>/path or tftp:/path

and only keep <ip>:/path for compatibility for nfs

In the futur with http we will want http://ip[:port]/path so the format