diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2020-04-15 15:21:58 +0200 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2020-04-15 16:40:10 +0200 |
commit | 2a1cedd2dc844ad6cabcd6f08791f16e0f4febae (patch) | |
tree | 14966b64e68f26c0270a962619693686040cb2ec /sgsnemu | |
parent | c43e887e9ebef798760aeb2e0e9649d92d9d8551 (diff) |
Rename netdev_*route to end in route4
Functions for IPv6 will be added soon afterwards. Also take the chance
to check for address length in sgsnemu and only apply the route if the
address matches.
Change-Id: Ic6c1b3c11c56f047e6e8c6f1040257fd62afea0f
Diffstat (limited to 'sgsnemu')
-rw-r--r-- | sgsnemu/sgsnemu.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/sgsnemu/sgsnemu.c b/sgsnemu/sgsnemu.c index 6b05ac5..c28df52 100644 --- a/sgsnemu/sgsnemu.c +++ b/sgsnemu/sgsnemu.c @@ -1516,9 +1516,11 @@ static int create_pdp_conf(struct pdp_t *pdp, void *cbp, int cause) /* printf("Setting up interface and routing\n"); */ tun_addaddr(tun, &addr[i], NULL, prefixlen); if (options.defaultroute) { - struct in_addr rm; - rm.s_addr = 0; - netdev_addroute(&rm, &addr[i].v4, &rm); + if (in46a_is_v4(&addr[i])) { + struct in_addr rm; + rm.s_addr = 0; + netdev_addroute4(&rm, &addr[i].v4, &rm); + } } if (options.ipup) tun_runscript(tun, options.ipup); @@ -1718,9 +1720,11 @@ int main(int argc, char **argv) if ((options.createif) && (options.netaddr.len)) { tun_addaddr(tun, &options.netaddr, NULL, options.prefixlen); if (options.defaultroute) { - struct in_addr rm; - rm.s_addr = 0; - netdev_addroute(&rm, &options.netaddr.v4, &rm); + if (in46a_is_v4(&options.netaddr)) { + struct in_addr rm; + rm.s_addr = 0; + netdev_addroute4(&rm, &options.netaddr.v4, &rm); + } } if (options.ipup) tun_runscript(tun, options.ipup); |